From 4a776b4137b42aa826a724b2180a13c01c586ee8 Mon Sep 17 00:00:00 2001 From: Rui Date: Fri, 11 Apr 2025 10:45:22 -0500 Subject: [PATCH 1/2] fix: grep usage to read PR tags --- .github/workflows/publish-package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index da8fb9d..f061923 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -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)." From f459575f3e54a95fbad7f321d44b18264259c588 Mon Sep 17 00:00:00 2001 From: Rui Date: Fri, 11 Apr 2025 12:11:12 -0500 Subject: [PATCH 2/2] chore: attempt to use GITHUB_TOKEN for pushing --- .github/workflows/publish-package.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index f061923..254cdd2 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -8,7 +8,7 @@ on: - main permissions: - contents: write # To push version bump commit and tag + contents: write jobs: publish: @@ -55,8 +55,10 @@ 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 @@ -64,11 +66,6 @@ jobs: 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