Skip to content

Commit d2f3448

Browse files
committed
ci(release): dispatch release workflow after tagging
1 parent 37bd374 commit d2f3448

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

‎.github/workflows/auto-release.yml‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
permissions:
1212
contents: write
13+
actions: write
1314

1415
concurrency:
1516
group: auto-release-${{ github.ref }}
@@ -38,18 +39,31 @@ jobs:
3839
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
3940
4041
- name: Create and push tag (if missing)
42+
id: tagger
4143
shell: bash
4244
env:
4345
TAG: ${{ steps.meta.outputs.tag }}
4446
run: |
47+
CREATED=0
4548
if git ls-remote --tags origin "refs/tags/${TAG}" | grep -q "refs/tags/${TAG}$"; then
4649
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
4858
fi
4959
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

Comments
 (0)