|
| 1 | +name: "Release" |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
| 6 | +# there should never be two releases in progress at the same time |
| 7 | +concurrency: |
| 8 | + group: release |
| 9 | + cancel-in-progress: false |
| 10 | + |
| 11 | +on: |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + version: |
| 15 | + description: tag the latest commit on main with the given version (prefixed with v) |
| 16 | + required: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + |
| 20 | + version-available: |
| 21 | + uses: anchore/workflows/.github/workflows/check-version-available.yaml@4f25313f96311410cad4173f74617654a3e46d48 # v0.3.0 |
| 22 | + with: |
| 23 | + version: ${{ github.event.inputs.version }} |
| 24 | + |
| 25 | + check-gate: |
| 26 | + permissions: |
| 27 | + checks: read # required for getting the status of specific check names |
| 28 | + uses: anchore/workflows/.github/workflows/check-gate.yaml@4f25313f96311410cad4173f74617654a3e46d48 # v0.3.0 |
| 29 | + with: |
| 30 | + # these are checks that should be run on pull-request and merges to main. |
| 31 | + # we do NOT want to kick off a release if these have not been verified on main. |
| 32 | + # Please see the validations.yaml workflow for the names that should be used here. |
| 33 | + checks: '["Static analysis", "Unit tests"]' |
| 34 | + |
| 35 | + release: |
| 36 | + needs: [check-gate, version-available] |
| 37 | + environment: release # contains secrets needed for release |
| 38 | + runs-on: ubuntu-24.04 |
| 39 | + permissions: |
| 40 | + contents: write # needed for creating github release objects |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 |
| 43 | + with: |
| 44 | + fetch-depth: 0 # we need the full history to reason about changelogs and tags |
| 45 | + persist-credentials: true # needed for pushing a tag |
| 46 | + |
| 47 | + # setup checkout, go, go-make, binny, and cache go modules |
| 48 | + - uses: anchore/go-make/.github/actions/setup@383ef7852b8ae43a30f424896b52479186d2ea4d # v0.1.0 |
| 49 | + |
| 50 | + - name: Create release |
| 51 | + env: |
| 52 | + GITHUB_TOKEN: ${{ github.token }} |
| 53 | + DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} |
| 54 | + RELEASE_VERSION: ${{ github.event.inputs.version }} |
| 55 | + run: make ci-release |
0 commit comments