Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- main

permissions:
contents: write # To push version bump commit and tag
contents: write

jobs:
publish:
Expand All @@ -18,12 +18,12 @@ jobs:
- name: Determine version type from label
id: version-type
run: |
LABELS="${{ toJson(github.event.pull_request.labels.*.name) }}"
if echo "$LABELS" | grep -q 'release-major'; then
LABELS='${{ toJson(github.event.pull_request.labels.*.name) }}'
if echo $LABELS | jq '.[] | select(. == "release-major")'; then
echo "type=major" >> $GITHUB_OUTPUT
elif echo "$LABELS" | grep -q 'release-minor'; then
elif echo $LABELS | jq '.[] | select(. == "release-minor")'; then
echo "type=minor" >> $GITHUB_OUTPUT
elif echo "$LABELS" | grep -q 'release-patch'; then
elif echo $LABELS | jq '.[] | select(. == "release-patch")'; then
echo "type=patch" >> $GITHUB_OUTPUT
else
echo "::error::No valid release label found (release-major, release-minor, release-patch)."
Expand Down Expand Up @@ -55,20 +55,17 @@ jobs:
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

- name: Bump version
- name: Tag release
id: bump-version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION_TYPE="${{ steps.version-type.outputs.type }}"
yarn version --"$VERSION_TYPE" --no-git-tag-version
NEW_VERSION=$(node -p "require('./package.json').version")
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
git add package.json
git commit -m "chore: bump version to $NEW_VERSION"
git push

- name: Create tag
run: |
NEW_VERSION=${{ steps.bump-version.outputs.new_version }}
git tag v$NEW_VERSION
git push --tags

Expand Down
Loading