name: Release on: push: tags: - "v*" workflow_dispatch: inputs: version: description: "Release version, for example 0.1.0" required: true default: "0.1.0" permissions: contents: write jobs: macos-arm64-dmg: name: Build macOS ARM64 DMG runs-on: macos-26 steps: - name: Check out repository uses: actions/checkout@v6 with: submodules: recursive - name: Resolve version id: version shell: bash run: | if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then VERSION="${GITHUB_REF_NAME#v}" TAG_NAME="${GITHUB_REF_NAME}" else VERSION="${{ inputs.version }}" TAG_NAME="v${VERSION}" fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT" echo "Version: $VERSION" - name: Show build environment run: | uname -a swift --version xcodebuild -version xcode-select -p xcrun --sdk macosx --show-sdk-version - name: Verify macOS 26+ SDK shell: bash run: | SDK_VERSION="$(xcrun --sdk macosx --show-sdk-version)" SDK_MAJOR="${SDK_VERSION%%.*}" if [[ "$SDK_MAJOR" -lt 26 ]]; then echo "Expected at least macOS 26 SDK, got macOS $SDK_VERSION" >&2 exit 1 fi - name: Fetch media engines run: Scripts/fetch_media_engines.sh - name: Build app bundle env: MARKETING_VERSION: ${{ steps.version.outputs.version }} BUILD_NUMBER: ${{ github.run_number }} run: Scripts/create_app_bundle.sh - name: Verify ARM64 binary run: | file build/Firelink.app/Contents/MacOS/Firelink lipo -archs build/Firelink.app/Contents/MacOS/Firelink | grep -qx arm64 codesign --verify --deep --strict build/Firelink.app RESOURCES="build/Firelink.app/Contents/Resources" test -d "$RESOURCES/_internal" test -x "$RESOURCES/yt-dlp" test -x "$RESOURCES/deno" test -x "$RESOURCES/ffmpeg" test -x "$RESOURCES/aria2c" test -f "$RESOURCES/aria2-cacert.pem" test -d "$RESOURCES/aria2-libs" test "$(tr -d '[:space:]' < "$RESOURCES/aria2-version.txt")" = "1.37.0-2-arm64-sonoma" test "$("$RESOURCES/yt-dlp" --version)" = "$(tr -d '[:space:]' < "$RESOURCES/yt-dlp-version.txt")" "$RESOURCES/deno" --version "$RESOURCES/ffmpeg" -version "$RESOURCES/aria2c" --version | grep -q '^aria2 version 1.37.0$' for library in "$RESOURCES"/aria2-libs/*.dylib; do lipo -archs "$library" | grep -qx arm64 done ! otool -L "$RESOURCES/aria2c" "$RESOURCES"/aria2-libs/*.dylib | grep -Eq '(@@HOMEBREW|/opt/homebrew|/usr/local)' - name: Create DMG env: VERSION: ${{ steps.version.outputs.version }} ARCH: arm64 run: Scripts/create_dmg.sh - name: Upload workflow artifact uses: actions/upload-artifact@v7 with: name: Firelink-${{ steps.version.outputs.version }}-mac-arm64-dmg path: dist/*.dmg if-no-files-found: error - name: Publish GitHub release if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch' env: GH_TOKEN: ${{ github.token }} run: | VERSION="${{ steps.version.outputs.version }}" TAG_NAME="${{ steps.version.outputs.tag_name }}" awk '/^## \['"$VERSION"'\]/{flag=1; next} /^## \[/{if(flag) exit} flag' CHANGELOG.md > release_notes.md test -s release_notes.md if gh release view "$TAG_NAME" >/dev/null 2>&1; then gh release upload "$TAG_NAME" dist/*.dmg --clobber gh release edit "$TAG_NAME" --notes-file release_notes.md else if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then gh release create "$TAG_NAME" dist/*.dmg --title "$TAG_NAME" --notes-file release_notes.md else gh release create "$TAG_NAME" dist/*.dmg --title "$TAG_NAME" --notes-file release_notes.md --verify-tag fi fi