|
| 1 | +# This workflow is meant to trigger a build of Docker binaries when a release |
| 2 | +# is published, it uses the existing `zfnd-build-docker-image.yml` workflow |
| 3 | +# |
| 4 | +# We use a separate action as we might want to trigger this under |
| 5 | +# different circumstances than a Continuous Deployment, for example. |
| 6 | +# |
| 7 | +# This workflow is triggered if: |
| 8 | +# - A release is published |
| 9 | +# - A pre-release is changed to a release |
| 10 | +name: Release binaries |
| 11 | + |
| 12 | +on: |
| 13 | + release: |
| 14 | + types: |
| 15 | + - released |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +jobs: |
| 21 | + # The image will be named `zebra:<semver>` |
| 22 | + build: |
| 23 | + name: Build Release Docker |
| 24 | + permissions: |
| 25 | + contents: read |
| 26 | + id-token: write |
| 27 | + pull-requests: write |
| 28 | + uses: ./.github/workflows/zfnd-build-docker-image.yml |
| 29 | + with: |
| 30 | + dockerfile_path: ./docker/Dockerfile |
| 31 | + dockerfile_target: runtime |
| 32 | + image_name: zebra |
| 33 | + short_sha: '' |
| 34 | + features: ${{ vars.RUST_PROD_FEATURES }} |
| 35 | + rust_log: ${{ vars.RUST_LOG }} |
| 36 | + # Enable Docker Hub publishing for official releases (this is the single source of truth for production images) |
| 37 | + # The deploy-nodes workflow also builds for releases but doesn't publish to Docker Hub (defaults to false) |
| 38 | + publish_to_dockerhub: true |
| 39 | + # This step needs access to Docker Hub secrets to run successfully |
| 40 | + secrets: |
| 41 | + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} |
| 42 | + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} |
| 43 | + |
| 44 | + dockerhub-description: |
| 45 | + if: github.repository_owner == 'ZcashFoundation' |
| 46 | + runs-on: ubuntu-latest |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1 |
| 49 | + with: |
| 50 | + persist-credentials: false |
| 51 | + |
| 52 | + - name: Docker Hub Description |
| 53 | + uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa #v5.0.0 |
| 54 | + with: |
| 55 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 56 | + password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 57 | + repository: zfnd/zebra |
| 58 | + short-description: ${{ github.event.repository.description }} |
| 59 | + |
| 60 | + release-binaries-success: |
| 61 | + name: Release binaries success |
| 62 | + runs-on: ubuntu-latest |
| 63 | + # Only run when the Docker Hub update job is allowed to execute |
| 64 | + if: >- |
| 65 | + ${{ |
| 66 | + always() && |
| 67 | + github.repository_owner == 'ZcashFoundation' |
| 68 | + }} |
| 69 | + needs: |
| 70 | + - build |
| 71 | + - dockerhub-description |
| 72 | + timeout-minutes: 1 |
| 73 | + steps: |
| 74 | + - name: Decide whether the needed jobs succeeded or failed |
| 75 | + uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe #v1.2.2 |
| 76 | + with: |
| 77 | + jobs: ${{ toJSON(needs) }} |
| 78 | + |
| 79 | + failure-issue: |
| 80 | + name: Open or update issues for release binaries failures |
| 81 | + # When a new job is added to this workflow, add it to this list. |
| 82 | + needs: [ build, dockerhub-description ] |
| 83 | + # Open tickets for any failed build in this workflow. |
| 84 | + if: failure() || cancelled() |
| 85 | + runs-on: ubuntu-latest |
| 86 | + permissions: |
| 87 | + issues: write |
| 88 | + steps: |
| 89 | + - uses: jayqi/failed-build-issue-action@1a893bbf43ef1c2a8705e2b115cd4f0fe3c5649b #v1.2.0 |
| 90 | + with: |
| 91 | + title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}" |
| 92 | + # New failures open an issue with this label. |
| 93 | + label-name: S-ci-fail-binaries-auto-issue |
| 94 | + # If there is already an open issue with this label, any failures become comments on that issue. |
| 95 | + always-create-new-issue: false |
| 96 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments