Skip to content

Commit 0e94eee

Browse files
committed
CI: major and minor changes
Made semver tagging bump tag if it receives the appropriate tag. Also made the gh-pages push job use GITHUB_TOKEN. Also removed env from semver tag job and made open pr tag job use GITHUB_TOKEN and removed set_url command as it isn't needed.
1 parent 58fec0c commit 0e94eee

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

.github/workflows/test-tag.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ jobs:
225225
cd gh-pages
226226
git config user.name "github-actions[bot]"
227227
git config user.email "github-actions[bot]@users.noreply.github.com"
228-
git remote set-url origin https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}
228+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
229229
git add .
230230
git commit -m "Deploy coverage: ${{ steps.meta.outputs.folder }}"
231231
git push origin gh-pages
@@ -257,18 +257,26 @@ jobs:
257257
echo "bump=major" >> "$GITHUB_OUTPUT"
258258
elif echo "$COMMIT_MSG" | grep -iq "#minor"; then
259259
echo "bump=minor" >> "$GITHUB_OUTPUT"
260-
else
260+
elif echo "$COMMIT_MSG" | grep -iq "#patch"; then
261261
echo "bump=patch" >> "$GITHUB_OUTPUT"
262+
else
263+
echo "bump=none" >> "$GITHUB_OUTPUT"
262264
fi
263265
264266
- name: Bump version
265267
id: bump_version
266268
run: |
269+
BUMP_TYPE=${{ steps.bump_type.outputs.bump }}
270+
if [ "$BUMP_TYPE" == "none" ]; then
271+
echo "No version bump required. Skipping tag creation."
272+
exit 0 # Skip version bump
273+
fi
274+
267275
OLD_TAG=${{ steps.get_tag.outputs.tag }}
268276
VERSION=${OLD_TAG#v}
269277
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
270278
271-
case "${{ steps.bump_type.outputs.bump }}" in
279+
case "$BUMP_TYPE" in
272280
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0;;
273281
minor) MINOR=$((MINOR + 1)); PATCH=0;;
274282
patch) PATCH=$((PATCH + 1));;
@@ -278,14 +286,13 @@ jobs:
278286
echo "new_tag=$NEW_TAG" >> "$GITHUB_OUTPUT"
279287
280288
- name: Create and push new tag
289+
if: steps.bump_version.outcome != 'skipped'
281290
run: |
282291
git config user.name "github-actions[bot]"
283292
git config user.email "github-actions[bot]@users.noreply.github.com"
284293
git remote set-url origin https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}
285294
git tag ${{ steps.bump_version.outputs.new_tag }}
286295
git push origin ${{ steps.bump_version.outputs.new_tag }}
287-
env:
288-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
289296
290297
tag-open-pr:
291298
name: Tag Open Pull Request (Non-Semantic)
@@ -307,11 +314,10 @@ jobs:
307314
308315
git config user.name "github-actions[bot]"
309316
git config user.email "github-actions[bot]@users.noreply.github.com"
310-
git remote set-url origin https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}
311317
git tag "$TAG"
312318
git push origin "$TAG"
313319
env:
314-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
320+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
315321

316322
cleanup:
317323
name: Delete Merged PR Tags

0 commit comments

Comments
 (0)