feat: introduce concurrent export for improved performance #85
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| - 'v[0-9]+.[0-9]+.[0-9]+-*' | |
| permissions: | |
| contents: write | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.platform }}) | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-15 | |
| platform: macos | |
| build-path: apple/Products/Release | |
| archive-name: exfig-macos | |
| - os: ubuntu-latest | |
| platform: linux-x64 | |
| build-path: x86_64-unknown-linux-gnu/release | |
| archive-name: exfig-linux-x64 | |
| container: swift:6.2-jammy | |
| extra-flags: --static-swift-stdlib -Xlinker -lcurl -Xlinker -lxml2 -Xlinker -lssl -Xlinker -lcrypto -Xlinker -lz | |
| runs-on: ${{ matrix.os }} | |
| container: ${{ matrix.container }} | |
| steps: | |
| - name: Install Git LFS (Linux) | |
| if: matrix.platform == 'linux-x64' | |
| run: | | |
| apt-get update | |
| apt-get install -y git-lfs | |
| git lfs install | |
| - uses: actions/checkout@v6 | |
| with: | |
| lfs: true | |
| - name: Select Xcode 26.1 (macOS) | |
| if: matrix.platform == 'macos' | |
| run: sudo xcode-select -s /Applications/Xcode_26.1.1.app/Contents/Developer | |
| - name: Install system dependencies (Linux) | |
| if: matrix.platform == 'linux-x64' | |
| run: | | |
| apt-get install -y libcurl4-openssl-dev libxml2-dev libssl-dev | |
| - name: Set version from tag | |
| run: | | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| FILE="Sources/ExFigCLI/ExFigCommand.swift" | |
| if [ "${{ matrix.platform }}" = "macos" ]; then | |
| sed -i '' "s/static let version = \".*\"/static let version = \"$VERSION\"/" "$FILE" | |
| else | |
| sed -i "s/static let version = \".*\"/static let version = \"$VERSION\"/" "$FILE" | |
| fi | |
| - name: Build release binary (macOS) | |
| if: matrix.platform == 'macos' | |
| run: | | |
| # Build each architecture separately to avoid xcodebuild issues with binary targets | |
| swift build -c release --arch arm64 | |
| swift build -c release --arch x86_64 | |
| # Create universal binary | |
| mkdir -p .build/apple/Products/Release | |
| lipo -create \ | |
| .build/arm64-apple-macosx/release/exfig \ | |
| .build/x86_64-apple-macosx/release/exfig \ | |
| -output .build/apple/Products/Release/exfig | |
| # Copy resource bundles from arm64 build (they're arch-independent) | |
| cp -r .build/arm64-apple-macosx/release/*.bundle .build/apple/Products/Release/ | |
| - name: Build release binary (Linux) | |
| if: matrix.platform == 'linux-x64' | |
| run: swift build -c release ${{ matrix.extra-flags }} | |
| - name: Create release archive (macOS) | |
| if: matrix.platform == 'macos' | |
| run: | | |
| mkdir -p dist | |
| cp .build/${{ matrix.build-path }}/exfig dist/ExFig | |
| cp -r .build/${{ matrix.build-path }}/exfig_AndroidExport.bundle dist/ | |
| cp -r .build/${{ matrix.build-path }}/exfig_XcodeExport.bundle dist/ | |
| cp -r .build/${{ matrix.build-path }}/exfig_FlutterExport.bundle dist/ | |
| cp -r .build/${{ matrix.build-path }}/exfig_WebExport.bundle dist/ | |
| cp -r .build/${{ matrix.build-path }}/exfig_ExFigCLI.bundle dist/ | |
| cp LICENSE dist/ | |
| cd dist && zip -r ../${{ matrix.archive-name }}.zip . | |
| - name: Create release archive (Linux) | |
| if: matrix.platform == 'linux-x64' | |
| run: | | |
| mkdir -p dist | |
| cp .build/${{ matrix.build-path }}/exfig dist/ExFig | |
| cp -r .build/${{ matrix.build-path }}/exfig_AndroidExport.resources dist/ | |
| cp -r .build/${{ matrix.build-path }}/exfig_XcodeExport.resources dist/ | |
| cp -r .build/${{ matrix.build-path }}/exfig_FlutterExport.resources dist/ | |
| cp -r .build/${{ matrix.build-path }}/exfig_WebExport.resources dist/ | |
| cp -r .build/${{ matrix.build-path }}/exfig_ExFigCLI.resources dist/ | |
| cp LICENSE dist/ | |
| cd dist && tar -czf ../${{ matrix.archive-name }}.tar.gz -- * | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.archive-name }} | |
| path: | | |
| ${{ matrix.archive-name }}.zip | |
| ${{ matrix.archive-name }}.tar.gz | |
| if-no-files-found: ignore | |
| update-version: | |
| name: Update Version and Changelog | |
| needs: build | |
| if: ${{ !contains(github.ref, '-') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update version in main branch | |
| run: | | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| FILE="Sources/ExFigCLI/ExFigCommand.swift" | |
| sed -i "s/static let version = \".*\"/static let version = \"$VERSION\"/" "$FILE" | |
| sed -i "s/version = \".*\"/version = \"${VERSION#v}\"/" "Sources/ExFigCLI/Resources/Schemas/PklProject" | |
| - name: Update CHANGELOG.md | |
| uses: orhun/git-cliff-action@v4 | |
| with: | |
| config: cliff.toml | |
| args: --output CHANGELOG.md | |
| env: | |
| GITHUB_REPO: ${{ github.repository }} | |
| - name: Commit and push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Sources/ExFigCLI/ExFigCommand.swift Sources/ExFigCLI/Resources/Schemas/PklProject CHANGELOG.md | |
| git diff --staged --quiet || git commit -m "chore(release): bump version to ${GITHUB_REF#refs/tags/v}" | |
| git push origin main | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Generate release notes | |
| id: changelog | |
| uses: orhun/git-cliff-action@v4 | |
| with: | |
| config: cliff.toml | |
| args: --latest --strip header | |
| env: | |
| GITHUB_REPO: ${{ github.repository }} | |
| - name: Install Pkl CLI | |
| run: | | |
| curl -sL https://github.com/apple/pkl/releases/download/0.30.2/pkl-linux-amd64 -o /usr/local/bin/pkl | |
| chmod +x /usr/local/bin/pkl | |
| - name: Update PklProject version | |
| run: | | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| sed -i "s/version = \".*\"/version = \"$VERSION\"/" Sources/ExFigCLI/Resources/Schemas/PklProject | |
| - name: Package PKL schemas | |
| run: | | |
| pkl project package \ | |
| --output-path ".pkl-out/%{name}@%{version}/" \ | |
| Sources/ExFigCLI/Resources/Schemas | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body: ${{ steps.changelog.outputs.content }} | |
| prerelease: ${{ contains(github.ref, '-') }} | |
| files: | | |
| artifacts/exfig-macos/exfig-macos.zip | |
| artifacts/exfig-linux-x64/exfig-linux-x64.tar.gz | |
| .pkl-out/exfig@*/* | |
| update-homebrew: | |
| name: Update Homebrew Tap | |
| needs: release | |
| if: ${{ !contains(github.ref, '-') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get version from tag | |
| id: version | |
| run: echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT" | |
| - name: Download release assets and calculate SHA256 | |
| id: sha | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| curl -sL "https://github.com/alexey1312/ExFig/releases/download/v${VERSION}/exfig-macos.zip" -o exfig-macos.zip | |
| MACOS_SHA=$(sha256sum exfig-macos.zip | cut -d' ' -f1) | |
| echo "macos=${MACOS_SHA}" >> "$GITHUB_OUTPUT" | |
| curl -sL "https://github.com/alexey1312/ExFig/releases/download/v${VERSION}/exfig-linux-x64.tar.gz" -o exfig-linux.tar.gz | |
| LINUX_SHA=$(sha256sum exfig-linux.tar.gz | cut -d' ' -f1) | |
| echo "linux=${LINUX_SHA}" >> "$GITHUB_OUTPUT" | |
| - name: Checkout Homebrew tap | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: alexey1312/homebrew-exfig | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| path: homebrew-exfig | |
| - name: Update formula | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| MACOS_SHA="${{ steps.sha.outputs.macos }}" | |
| LINUX_SHA="${{ steps.sha.outputs.linux }}" | |
| FORMULA="homebrew-exfig/Formula/exfig.rb" | |
| sed -i "s/version \".*\"/version \"${VERSION}\"/" "$FORMULA" | |
| sed -i "0,/sha256 \"[a-f0-9]*\"/s//sha256 \"${MACOS_SHA}\"/" "$FORMULA" | |
| sed -i "0,/sha256 \"${MACOS_SHA}\"/! {0,/sha256 \"[a-f0-9]*\"/s//sha256 \"${LINUX_SHA}\"/}" "$FORMULA" | |
| cat "$FORMULA" | |
| - name: Commit and push | |
| working-directory: homebrew-exfig | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/exfig.rb | |
| git diff --staged --quiet || git commit -m "chore: bump to v${{ steps.version.outputs.version }}" | |
| git push | |
| deploy-docs: | |
| name: Deploy DocC | |
| needs: release | |
| if: ${{ !contains(github.ref, '-') }} | |
| runs-on: macos-15 | |
| timeout-minutes: 30 | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| env: | |
| DEVELOPER_DIR: "/Applications/Xcode_26.1.1.app/Contents/Developer" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build DocC | |
| run: | | |
| swift package --allow-writing-to-directory docs \ | |
| generate-documentation --target ExFig \ | |
| --disable-indexing \ | |
| --transform-for-static-hosting \ | |
| --hosting-base-path ExFig \ | |
| --output-path docs | |
| echo '<script>window.location.href += "/documentation/exfig"</script>' > docs/index.html | |
| - uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: 'docs' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |