Remove deprecated Mac runner, retain universal build #48
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]+" | |
| - test | |
| permissions: {} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RELEASE_BIN: irma-core | |
| REGISTRY: ghcr.io | |
| jobs: | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| outputs: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract Changelog | |
| id: extract_changelog | |
| shell: bash | |
| run: perl .github/scripts/last_release_notes.pl > $RUNNER_TEMP/release_notes.md | |
| - name: Create Release | |
| id: create_release | |
| shell: bash | |
| run: | | |
| [[ "${{ github.ref_name }}" == "test" ]] && latest="--latest=false" || latest= | |
| gh release create "${{ github.ref_name }}" \ | |
| --title "IRMA-core ${{ github.ref_name }}" \ | |
| --notes-file "$RUNNER_TEMP/release_notes.md" \ | |
| $latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-release-image-and-rhel8-artifacts: | |
| name: Build and Push Release Image | |
| needs: [create-release] | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| runner: ubuntu-latest | |
| - arch: aarch64 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository }} | |
| tags: | | |
| type=raw,value=latest-${{ matrix.arch }} | |
| - name: Build and push Docker image | |
| id: buildpush | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| - name: Prepare Linux Binary | |
| shell: bash | |
| run: | | |
| IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | grep -- '-${{ matrix.arch }}$' | head -n 1) | |
| docker create --name temp-container $IMAGE_TAG \ | |
| && docker cp temp-container:/app/irma-core ./irma-core \ | |
| && docker rm temp-container \ | |
| && tar -czf ${{ env.RELEASE_BIN }}-linux-${{ matrix.arch }}-${{ github.ref_name }}.tar.gz irma-core | |
| - name: Upload Linux Release Asset | |
| shell: bash | |
| run: | | |
| gh release upload "${{ github.ref_name }}" ${{ env.RELEASE_BIN }}-linux-${{ matrix.arch }}-${{ github.ref_name }}.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| create-image-manifest: | |
| name: Create Image Manifest | |
| needs: build-release-image-and-rhel8-artifacts | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| steps: | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create and push manifests | |
| shell: bash | |
| run: | | |
| REPO=$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr '[A-Z]' '[a-z]') | |
| VERSION=${REPO}:${{ github.ref_name }} | |
| LATEST=${REPO}:latest | |
| docker manifest create $VERSION --amend ${LATEST}-x86_64 --amend ${LATEST}-aarch64 \ | |
| && docker manifest push $VERSION | |
| docker manifest create $LATEST --amend ${LATEST}-x86_64 --amend ${LATEST}-aarch64 \ | |
| && docker manifest push $LATEST | |
| build-mac-artifacts: | |
| name: Build Mac Artifacts | |
| needs: create-release | |
| runs-on: macos-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install latest nightly Rust | |
| run: | | |
| rustup update nightly | |
| rustup default nightly | |
| rustup target add aarch64-apple-darwin x86_64-apple-darwin | |
| - name: Build | |
| run: | | |
| cargo build --profile prod --target aarch64-apple-darwin --target x86_64-apple-darwin | |
| - name: Package Binary | |
| shell: bash | |
| run: | | |
| lipo -create -output ${{ env.RELEASE_BIN }} \ | |
| target/aarch64-apple-darwin/prod/${{ env.RELEASE_BIN }} \ | |
| target/x86_64-apple-darwin/prod/${{ env.RELEASE_BIN }} | |
| tar -czf ${{ env.RELEASE_BIN }}-apple-universal-${{ github.ref_name }}.tar.gz ${{ env.RELEASE_BIN }} | |
| - name: Upload Release Asset | |
| shell: bash | |
| run: | | |
| gh release upload "${{ github.ref_name }}" ${{ env.RELEASE_BIN }}-apple-universal-${{ github.ref_name }}.* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| create-integrated-package: | |
| name: Create Integrated Package | |
| needs: | |
| [build-mac-artifacts, build-release-image-and-rhel8-artifacts] | |
| runs-on: macos-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Release Assets | |
| shell: bash | |
| run: | | |
| gh release download "${{ github.ref_name }}" -p ${{ env.RELEASE_BIN }}-*.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Binaries and Create Integrated Package | |
| shell: bash | |
| run: | | |
| bin=${{ env.RELEASE_BIN }} | |
| tag=${{ github.ref_name }} | |
| tar -xzf ${bin}-apple-universal-${tag}.tar.gz && mv ${bin} ${bin}_Darwin \ | |
| && tar -xzf ${bin}-linux-x86_64-${tag}.tar.gz && mv ${bin} ${bin}_Linux_x86_64 \ | |
| && tar -xzf ${bin}-linux-aarch64-${tag}.tar.gz && mv ${bin} ${bin}_Linux_aarch64 \ | |
| && rm *gz \ | |
| && zip ${bin}-integrated-${tag}.zip irma-core_* | |
| - name: Upload Integrated Package | |
| shell: bash | |
| run: | | |
| gh release upload "${{ github.ref_name }}" ${{ env.RELEASE_BIN }}-integrated-${{ github.ref_name }}.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |