|
| 1 | +name: Main |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | +jobs: |
| 11 | + check: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 15 |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - name: Install tools |
| 17 | + uses: infrablocks/github-actions/asdf_install@v1 |
| 18 | + - name: Check |
| 19 | + run: ./go library:check |
| 20 | + - name: Notify Slack |
| 21 | + if: ${{ !cancelled() }} |
| 22 | + continue-on-error: true |
| 23 | + run: ./go "slack:notify[${{ job.status }}]" |
| 24 | + env: |
| 25 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
| 26 | + |
| 27 | + test: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + timeout-minutes: 15 |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + - name: Install tools |
| 33 | + uses: infrablocks/github-actions/asdf_install@v1 |
| 34 | + - name: Test |
| 35 | + run: ./go test:unit |
| 36 | + - name: Notify Slack |
| 37 | + if: ${{ !cancelled() }} |
| 38 | + continue-on-error: true |
| 39 | + run: ./go "slack:notify[${{ job.status }}]" |
| 40 | + env: |
| 41 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
| 42 | + |
| 43 | + prerelease: |
| 44 | + needs: [check, test] |
| 45 | + runs-on: ubuntu-latest |
| 46 | + timeout-minutes: 30 |
| 47 | + # Job-level group (here and on release): a run awaiting release approval |
| 48 | + # holds the slot, and a workflow-level group would freeze all main CI for |
| 49 | + # the approval window. queue: max keeps every queued run; the default |
| 50 | + # cancels all but the newest. |
| 51 | + concurrency: |
| 52 | + group: main |
| 53 | + cancel-in-progress: false |
| 54 | + queue: max |
| 55 | + permissions: |
| 56 | + contents: write |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + - name: Install tools |
| 60 | + uses: infrablocks/github-actions/asdf_install@v1 |
| 61 | + - name: Install secrets tools |
| 62 | + run: ./scripts/ci/common/install-git-crypt.sh |
| 63 | + - name: Unlock git-crypt |
| 64 | + run: ./go git_crypt:unlock_with_encrypted_gpg_key |
| 65 | + env: |
| 66 | + ENCRYPTION_PASSPHRASE: ${{ secrets.ENCRYPTION_PASSPHRASE }} |
| 67 | + - name: Configure RubyGems credentials |
| 68 | + run: ./scripts/ci/common/configure-rubygems.sh |
| 69 | + - name: Set CI git author |
| 70 | + run: ./go repository:set_ci_author |
| 71 | + - name: Bump version |
| 72 | + run: ./go "version:bump[pre]" |
| 73 | + - name: Release |
| 74 | + run: ./go release |
| 75 | + - name: Push commits |
| 76 | + run: git push |
| 77 | + - name: Push tags |
| 78 | + run: git push --tags |
| 79 | + - name: Notify Slack of release hold |
| 80 | + continue-on-error: true |
| 81 | + run: ./go "slack:notify[success,on_hold]" |
| 82 | + env: |
| 83 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
| 84 | + - name: Notify Slack |
| 85 | + if: ${{ !cancelled() }} |
| 86 | + continue-on-error: true |
| 87 | + run: ./go "slack:notify[${{ job.status }}]" |
| 88 | + env: |
| 89 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
| 90 | + |
| 91 | + release: |
| 92 | + needs: [prerelease] |
| 93 | + runs-on: ubuntu-latest |
| 94 | + timeout-minutes: 30 |
| 95 | + environment: release |
| 96 | + concurrency: |
| 97 | + group: main |
| 98 | + cancel-in-progress: false |
| 99 | + queue: max |
| 100 | + permissions: |
| 101 | + contents: write |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v4 |
| 104 | + with: |
| 105 | + ref: main |
| 106 | + - name: Pull latest main |
| 107 | + # Publishes main as of approval time, not the SHA that triggered the |
| 108 | + # run; --ff-only so a non-fast-forward fails loudly |
| 109 | + run: git pull --ff-only |
| 110 | + - name: Install tools |
| 111 | + uses: infrablocks/github-actions/asdf_install@v1 |
| 112 | + - name: Install secrets tools |
| 113 | + run: ./scripts/ci/common/install-git-crypt.sh |
| 114 | + - name: Unlock git-crypt |
| 115 | + run: ./go git_crypt:unlock_with_encrypted_gpg_key |
| 116 | + env: |
| 117 | + ENCRYPTION_PASSPHRASE: ${{ secrets.ENCRYPTION_PASSPHRASE }} |
| 118 | + - name: Configure RubyGems credentials |
| 119 | + run: ./scripts/ci/common/configure-rubygems.sh |
| 120 | + - name: Set CI git author |
| 121 | + run: ./go repository:set_ci_author |
| 122 | + - name: Bump version |
| 123 | + run: ./go "version:bump[minor]" |
| 124 | + - name: Release |
| 125 | + run: ./go release |
| 126 | + - name: Push commits |
| 127 | + run: git push |
| 128 | + - name: Push tags |
| 129 | + run: git push --tags |
| 130 | + - name: Notify Slack |
| 131 | + if: ${{ !cancelled() }} |
| 132 | + continue-on-error: true |
| 133 | + run: ./go "slack:notify[${{ job.status }}]" |
| 134 | + env: |
| 135 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
0 commit comments