Skip to content

Commit 2bd10c6

Browse files
author
Oleg
committed
Use gh cli to create tag and release
1 parent 5970ae4 commit 2bd10c6

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

.github/workflows/build.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,39 @@ jobs:
139139
permissions:
140140
contents: write
141141

142+
env:
143+
TAG: v${{ needs.meta.outputs.latest-version }}
144+
COMMIT: ${{ github.event.before }}
145+
142146
steps:
143147
- name: Checkout current head
144148
uses: actions/checkout@v4
145149
with:
146-
ref: ${{ github.event.before }}
150+
ref: ${{ env.COMMIT }}
147151

148-
- name: Mark the current head with the latest version before the update
152+
- name: Create a tag to mark previous latest version
149153
env:
150-
TAG: v${{ needs.meta.outputs.latest-version }}
151-
run: git tag $TAG && git push origin $TAG
154+
COMMIT: ${{ env.COMMIT }}
155+
run: >
156+
gh api
157+
--method POST
158+
-H "Accept: application/vnd.github+json"
159+
-H "X-GitHub-Api-Version: 2022-11-28"
160+
/repos/${{ github.repository }}/git/refs
161+
-f "ref=refs/tags/$TAG"
162+
-f "sha=$COMMIT"
163+
- name: Create release assotiated with the tag
164+
run: >
165+
gh api
166+
--method POST
167+
-H "Accept: application/vnd.github+json"
168+
-H "X-GitHub-Api-Version: 2022-11-28"
169+
/repos/${{ github.repository }}/releases
170+
-f "tag_name=$TAG"
171+
-f "name=$TAG"
172+
-f "body=Automatic release for $TAG"
173+
-f "generate_release_notes=true"
174+
152175
153176
automerge:
154177
needs: build

0 commit comments

Comments
 (0)