ci: set MARKETING_VERSION from git tag before build (#36) #148
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: Build | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - "*.*.*" | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Install SwiftLint | |
| run: brew install swiftlint | |
| - name: Run lint | |
| run: make lint | |
| trivy: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Install trivy | |
| env: | |
| TRIVY_VERSION: 0.69.3 | |
| run: | | |
| curl -sfL https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_macOS-ARM64.tar.gz | tar xz -C /usr/local/bin trivy | |
| - name: Run trivy | |
| run: trivy fs --severity HIGH,CRITICAL --exit-code 1 . | |
| build-ipa: | |
| needs: [lint, trivy] | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Set version from tag | |
| if: github.ref_type == 'tag' | |
| run: | | |
| VERSION="${GITHUB_REF_NAME}" | |
| sed -i '' "s/MARKETING_VERSION = .*/MARKETING_VERSION = ${VERSION};/" devicekit-ios.xcodeproj/project.pbxproj | |
| - name: Build unsigned IPA (real device) | |
| run: make ipa-unsigned | |
| - name: Upload IPA artifacts | |
| uses: actions/upload-artifact@v5 | |
| if: success() | |
| with: | |
| name: devicekit-ios-ipa | |
| path: build/export/*.ipa | |
| retention-days: 4 | |
| build-sim: | |
| needs: [lint, trivy] | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Set version from tag | |
| if: github.ref_type == 'tag' | |
| run: | | |
| VERSION="${GITHUB_REF_NAME}" | |
| sed -i '' "s/MARKETING_VERSION = .*/MARKETING_VERSION = ${VERSION};/" devicekit-ios.xcodeproj/project.pbxproj | |
| - name: Build simulator zips (arm64 + x86_64) | |
| run: make sim-zip | |
| - name: Upload simulator zip artifacts | |
| uses: actions/upload-artifact@v5 | |
| if: success() | |
| with: | |
| name: devicekit-ios-simulator-zips | |
| path: build/export/*-Sim-*.zip | |
| retention-days: 4 | |
| release: | |
| needs: [build-ipa, build-sim] | |
| if: github.ref_type == 'tag' && github.event_name == 'push' | |
| runs-on: macos-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| attestations: write | |
| steps: | |
| - name: Download IPA artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: devicekit-ios-ipa | |
| - name: Download simulator zip artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: devicekit-ios-simulator-zips | |
| - name: Attest build provenance | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-path: | | |
| *.ipa | |
| *-Sim-*.zip | |
| - name: Upload to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: Version ${{ github.ref_name }} | |
| files: | | |
| *.ipa | |
| *-Sim-*.zip |