Merge pull request #227 from dfinity/igor/bump-crates #151
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*" | |
| env: | |
| CARGO_TERM_COLOR: never | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| GIT_SHA: ${{ github.sha }} | |
| RELEASE_TAG: ${{ github.ref }} | |
| permissions: | |
| contents: write | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Install repro-env | |
| run: | | |
| wget 'https://github.com/kpcyrd/repro-env/releases/download/v0.4.5/repro-env' | |
| echo 'd6a52bc7cfce4ff2e20dcdd01daf83968429f03f225178ef7f687f286a0d0ab4 repro-env' | sha256sum -c - | |
| sudo install -m755 repro-env -t /usr/bin | |
| - name: Install deps | |
| run: sudo apt-get update && sudo apt-get -y install protobuf-compiler podman | |
| # Improves reproducibility | |
| - name: Set SOURCE_DATE_EPOCH | |
| run: echo "SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)" >> "$GITHUB_ENV" | |
| - name: Set Cargo.toml version | |
| shell: bash | |
| run: | | |
| mv Cargo.toml Cargo.toml.orig | |
| sed "s/0\\.0\\.0-git/${RELEASE_TAG##*\/v}/" Cargo.toml.orig > Cargo.toml | |
| rm -f Cargo.toml.orig | |
| - name: Build | |
| run: repro-env build --env SOURCE_DATE_EPOCH -- cargo build --features sev-snp,smtp,mcp --release --target x86_64-unknown-linux-musl --bin ic-gateway | |
| - name: Generate SHA checksum | |
| run: shasum target/x86_64-unknown-linux-musl/release/ic-gateway > ic-gateway.shasum | |
| - name: Remove build files | |
| run: rm -rf target | |
| - name: Build again | |
| run: repro-env build --env SOURCE_DATE_EPOCH -- cargo build --features sev-snp,smtp,mcp --release --target x86_64-unknown-linux-musl --bin ic-gateway | |
| - name: Check SHA checksum | |
| run: shasum -c ic-gateway.shasum | |
| - name: Strip | |
| run: /usr/bin/strip target/x86_64-unknown-linux-musl/release/ic-gateway | |
| - name: Create package root | |
| run: | | |
| mkdir -p .debpkg/usr/sbin | |
| mkdir -p .debpkg/etc/systemd/system | |
| mkdir -p .debpkg/etc/default | |
| mkdir -p .debpkg/DEBIAN | |
| cp target/x86_64-unknown-linux-musl/release/ic-gateway .debpkg/usr/sbin | |
| cp deploy/ic-gateway.service .debpkg/etc/systemd/system | |
| cp deploy/ic-gateway.env .debpkg/etc/default/ic-gateway | |
| chmod -R g-s .debpkg | |
| - uses: jiro4989/build-deb-action@1bd8ed1458d3dc331f62bf50468cce9b610fd0af | |
| with: | |
| package: ic-gateway | |
| package_root: .debpkg | |
| maintainer: "DFINITY Boundary Nodes Team" | |
| version: ${{ github.ref }} | |
| arch: amd64 | |
| desc: "IC-Gateway Service" | |
| homepage: "https://github.com/dfinity/ic-gateway" | |
| - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 | |
| with: | |
| makeLatest: true | |
| artifacts: "target/x86_64-unknown-linux-musl/release/ic-gateway,*.deb" | |
| body: "IC-Gateway release" | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata for Docker | |
| id: docker_meta | |
| uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Build and push Docker image | |
| id: docker_push | |
| uses: docker/build-push-action@1dc73863535b631f98b2378be8619f83b136f4a0 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.docker_meta.outputs.tags }} | |
| labels: ${{ steps.docker_meta.outputs.labels }} | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd | |
| with: | |
| subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| subject-digest: ${{ steps.docker_push.outputs.digest }} | |
| push-to-registry: true | |
| - name: Send Slack message | |
| uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3 | |
| with: | |
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: | | |
| text: "New `ic-gateway` release `${{ github.ref_name }}` has been published" |