|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + # bin/release only accepts digits joined by dots |
| 7 | + - '[0-9]+.[0-9]+.[0-9]+' |
| 8 | + - '[0-9]+.[0-9]+.[0-9]+.[0-9]+' |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + version: |
| 12 | + description: 'Tag to build' |
| 13 | + required: true |
| 14 | + dry-run: |
| 15 | + description: 'Build only, publish nothing' |
| 16 | + type: boolean |
| 17 | + default: true |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: "release-${{ github.ref }}" |
| 21 | + cancel-in-progress: false |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: write |
| 25 | + id-token: write |
| 26 | + attestations: write |
| 27 | + artifact-metadata: write |
| 28 | + # the plugin page reads the latest release, so it has to be rebuilt after one |
| 29 | + pages: write |
| 30 | + |
| 31 | +jobs: |
| 32 | + release: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + # The default branch, not the tag: bin/release archives the tag's tree |
| 36 | + # (git archive <tag>) but the tooling that does it has to be the current |
| 37 | + # one, exactly as when a maintainer runs it from their own checkout. |
| 38 | + # Not fetch-depth: 0 nor fetch-tags: true either, they would bring in |
| 39 | + # every tag, lightweight ones included, which bin/release cannot read. |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@v7 |
| 42 | + with: |
| 43 | + ref: ${{ github.event.repository.default_branch }} |
| 44 | + fetch-depth: 1 |
| 45 | + |
| 46 | + - name: Fetch the annotated tag |
| 47 | + env: |
| 48 | + TAG: ${{ inputs.version || github.ref_name }} |
| 49 | + run: git fetch --no-tags --force --depth=1 origin "+refs/tags/${TAG}:refs/tags/${TAG}" |
| 50 | + |
| 51 | + - name: Build and publish |
| 52 | + uses: galette/.github/actions/release-plugin@main |
| 53 | + with: |
| 54 | + version: ${{ inputs.version || github.ref_name }} |
| 55 | + dry-run: ${{ inputs.dry-run || false }} |
0 commit comments