|
1 | 1 | --- |
2 | | - name: Release |
| 2 | +name: Release |
3 | 3 |
|
4 | | - on: |
5 | | - workflow_dispatch: |
6 | | - pull_request_target: |
7 | | - types: |
8 | | - - closed |
9 | | - branches: |
10 | | - - main |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + pull_request_target: |
| 7 | + types: [ closed ] |
| 8 | + branches: [ main ] |
11 | 9 |
|
12 | | - permissions: |
13 | | - contents: read |
| 10 | +permissions: |
| 11 | + contents: read |
14 | 12 |
|
15 | | - jobs: |
16 | | - create_release: |
17 | | - # release if |
18 | | - # manual deployment OR |
19 | | - # merged to main and labelled with release labels |
20 | | - if: | |
21 | | - (github.event_name == 'workflow_dispatch') || |
22 | | - (github.event.pull_request.merged == true && |
23 | | - (contains(github.event.pull_request.labels.*.name, 'breaking') || |
24 | | - contains(github.event.pull_request.labels.*.name, 'feature') || |
25 | | - contains(github.event.pull_request.labels.*.name, 'vuln') || |
26 | | - contains(github.event.pull_request.labels.*.name, 'release'))) |
27 | | - outputs: |
28 | | - full-tag: ${{ steps.release-drafter.outputs.tag_name }} |
29 | | - short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }} |
30 | | - body: ${{ steps.release-drafter.outputs.body }} |
31 | | - runs-on: ubuntu-latest |
32 | | - permissions: |
33 | | - contents: write |
34 | | - pull-requests: read |
35 | | - steps: |
36 | | - - uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 |
37 | | - id: release-drafter |
38 | | - env: |
39 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
40 | | - with: |
41 | | - config-name: release-drafter.yml |
42 | | - publish: true |
43 | | - - name: Get the short tag |
44 | | - id: get_tag_name |
45 | | - run: | |
46 | | - short_tag=$(echo ${{ steps.release-drafter.outputs.tag_name }} | cut -d. -f1) |
47 | | - echo "SHORT_TAG=$short_tag" >> $GITHUB_OUTPUT |
48 | | - create_action_images: |
49 | | - needs: create_release |
50 | | - runs-on: ubuntu-latest |
51 | | - permissions: |
52 | | - packages: write |
53 | | - env: |
54 | | - REGISTRY: ghcr.io |
55 | | - IMAGE_NAME: github/issue_metrics # different than repo name (underscore instead of dash) |
56 | | - steps: |
57 | | - - name: Set up Docker Buildx |
58 | | - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb |
59 | | - - name: Log in to the Container registry |
60 | | - uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 |
61 | | - with: |
62 | | - registry: ${{ env.REGISTRY }} |
63 | | - username: ${{ github.actor }} |
64 | | - password: ${{ secrets.GITHUB_TOKEN }} |
65 | | - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 |
66 | | - - name: Push Docker Image |
67 | | - if: ${{ success() }} |
68 | | - uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 |
69 | | - with: |
70 | | - context: . |
71 | | - file: ./Dockerfile |
72 | | - push: true |
73 | | - tags: | |
74 | | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest |
75 | | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.full-tag }} |
76 | | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.short-tag }} |
77 | | - platforms: linux/amd64 |
78 | | - provenance: false |
79 | | - sbom: false |
80 | | - create_discussion: |
81 | | - needs: create_release |
82 | | - runs-on: ubuntu-latest |
83 | | - permissions: |
84 | | - discussions: write |
85 | | - steps: |
86 | | - - name: Create an announcement discussion for release |
87 | | - uses: abirismyname/create-discussion@6e6ef67e5eeb042343ef8b3d8d0f5d545cbdf024 |
88 | | - env: |
89 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
90 | | - with: |
91 | | - title: ${{ needs.create_release.outputs.full-tag }} |
92 | | - body: ${{ needs.create_release.outputs.body }} |
93 | | - repository-id: ${{ secrets.RELEASE_DISCUSSION_REPOSITORY_ID }} |
94 | | - category-id: ${{ secrets.RELEASE_DISCUSSION_CATEGORY_ID }} |
| 13 | +jobs: |
| 14 | + create_release: |
| 15 | + # release if |
| 16 | + # manual deployment OR |
| 17 | + # merged to main and labelled with release labels |
| 18 | + if: | |
| 19 | + (github.event_name == 'workflow_dispatch') || |
| 20 | + (github.event.pull_request.merged == true && |
| 21 | + (contains(github.event.pull_request.labels.*.name, 'breaking') || |
| 22 | + contains(github.event.pull_request.labels.*.name, 'feature') || |
| 23 | + contains(github.event.pull_request.labels.*.name, 'vuln') || |
| 24 | + contains(github.event.pull_request.labels.*.name, 'release'))) |
| 25 | + outputs: |
| 26 | + full-tag: ${{ steps.release-drafter.outputs.tag_name }} |
| 27 | + short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }} |
| 28 | + body: ${{ steps.release-drafter.outputs.body }} |
| 29 | + runs-on: ubuntu-latest |
| 30 | + permissions: |
| 31 | + contents: write |
| 32 | + pull-requests: read |
| 33 | + steps: |
| 34 | + - uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 |
| 35 | + id: release-drafter |
| 36 | + env: |
| 37 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + with: |
| 39 | + config-name: release-drafter.yml |
| 40 | + publish: true |
| 41 | + - name: Get the short tag |
| 42 | + id: get_tag_name |
| 43 | + run: | |
| 44 | + short_tag=$(echo ${{ steps.release-drafter.outputs.tag_name }} | cut -d. -f1) |
| 45 | + echo "SHORT_TAG=$short_tag" >> $GITHUB_OUTPUT |
| 46 | + create_action_images: |
| 47 | + needs: create_release |
| 48 | + runs-on: ubuntu-latest |
| 49 | + permissions: |
| 50 | + packages: write |
| 51 | + env: |
| 52 | + REGISTRY: ghcr.io |
| 53 | + IMAGE_NAME: github/issue_metrics # different than repo name (underscore instead of dash) |
| 54 | + steps: |
| 55 | + - name: Set up Docker Buildx |
| 56 | + uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb |
| 57 | + - name: Log in to the Container registry |
| 58 | + uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 |
| 59 | + with: |
| 60 | + registry: ${{ env.REGISTRY }} |
| 61 | + username: ${{ github.actor }} |
| 62 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 |
| 64 | + - name: Push Docker Image |
| 65 | + if: ${{ success() }} |
| 66 | + uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 |
| 67 | + with: |
| 68 | + context: . |
| 69 | + file: ./Dockerfile |
| 70 | + push: true |
| 71 | + tags: | |
| 72 | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest |
| 73 | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.full-tag }} |
| 74 | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.short-tag }} |
| 75 | + platforms: linux/amd64 |
| 76 | + provenance: false |
| 77 | + sbom: false |
| 78 | + create_discussion: |
| 79 | + needs: create_release |
| 80 | + runs-on: ubuntu-latest |
| 81 | + permissions: |
| 82 | + discussions: write |
| 83 | + steps: |
| 84 | + - name: Create an announcement discussion for release |
| 85 | + uses: abirismyname/create-discussion@6e6ef67e5eeb042343ef8b3d8d0f5d545cbdf024 |
| 86 | + env: |
| 87 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 88 | + with: |
| 89 | + title: ${{ needs.create_release.outputs.full-tag }} |
| 90 | + body: ${{ needs.create_release.outputs.body }} |
| 91 | + repository-id: ${{ secrets.RELEASE_DISCUSSION_REPOSITORY_ID }} |
| 92 | + category-id: ${{ secrets.RELEASE_DISCUSSION_CATEGORY_ID }} |
0 commit comments