|
10 | 10 |
|
11 | 11 | permissions: |
12 | 12 | contents: write |
| 13 | + actions: write |
13 | 14 |
|
14 | 15 | concurrency: |
15 | 16 | group: auto-release-${{ github.ref }} |
@@ -38,18 +39,31 @@ jobs: |
38 | 39 | echo "tag=$TAG" >> "$GITHUB_OUTPUT" |
39 | 40 |
|
40 | 41 | - name: Create and push tag (if missing) |
| 42 | + id: tagger |
41 | 43 | shell: bash |
42 | 44 | env: |
43 | 45 | TAG: ${{ steps.meta.outputs.tag }} |
44 | 46 | run: | |
| 47 | + CREATED=0 |
45 | 48 | if git ls-remote --tags origin "refs/tags/${TAG}" | grep -q "refs/tags/${TAG}$"; then |
46 | 49 | echo "Tag already exists: ${TAG}" |
47 | | - exit 0 |
| 50 | + else |
| 51 | + GIT_AUTHOR_NAME="github-actions[bot]" \ |
| 52 | + GIT_AUTHOR_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" \ |
| 53 | + GIT_COMMITTER_NAME="github-actions[bot]" \ |
| 54 | + GIT_COMMITTER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" \ |
| 55 | + git tag -a "${TAG}" -m "Release ${TAG}" |
| 56 | + git push origin "${TAG}" |
| 57 | + CREATED=1 |
48 | 58 | fi |
49 | 59 |
|
50 | | - GIT_AUTHOR_NAME="github-actions[bot]" \ |
51 | | - GIT_AUTHOR_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" \ |
52 | | - GIT_COMMITTER_NAME="github-actions[bot]" \ |
53 | | - GIT_COMMITTER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" \ |
54 | | - git tag -a "${TAG}" -m "Release ${TAG}" |
55 | | - git push origin "${TAG}" |
| 60 | + echo "created=${CREATED}" >> "$GITHUB_OUTPUT" |
| 61 | +
|
| 62 | + - name: Dispatch release workflow |
| 63 | + if: steps.tagger.outputs.created == '1' |
| 64 | + shell: bash |
| 65 | + env: |
| 66 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + TAG: ${{ steps.meta.outputs.tag }} |
| 68 | + run: | |
| 69 | + gh workflow run release --field tag="$TAG" |
0 commit comments