Skip to content

Commit

Permalink
Adjusted workflow to push tags after the release is successful and al…
Browse files Browse the repository at this point in the history
…so commit the package.json
  • Loading branch information
syedsalehinipg committed May 16, 2024
1 parent 44f26f9 commit e9ca57f
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/npm-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,29 @@ jobs:
pnpm test
pnpm test:docker
- name: Bump Version and Create Tag
- name: Bump Version
run: |
pnpm version prerelease --no-git-tag-version
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag -a "v$(node -p "require('./package.json').version")" -m "Version $(node -p "require('./package.json').version")"
echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
env:
CI: true
id: version

- name: Publish to npm
run: pnpm publish --access=public --tag=next

- name: Commit Version Changes
run: |
git add package.json
git commit -m "Bump version to ${{ env.VERSION }}"
# Create the Git tag with the version from package.json
git tag -a "v${{ env.VERSION }}" -m "Version ${{ env.VERSION }}"
- name: Push Changes and Tags
run: |
git push
git push --tags
- name: Generate Release Notes from Merge Commit Messages
run: |
Expand All @@ -48,21 +62,12 @@ jobs:
COMMIT_RANGE=$(git rev-parse HEAD^2)..$(git rev-parse HEAD)
COMMIT_MESSAGES=$(git log $COMMIT_RANGE --pretty=format:"%s")
echo "$COMMIT_MESSAGES" > commit_messages.txt
id: release_notes

- name: Push Tags
run: |
git push
git push --tags
- name: Publish to npm
run: pnpm publish --access=public --tag=next
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: Release ${{ steps.version.outputs.VERSION }}
tag_name: "v${{ env.VERSION }}"
name: Release ${{ env.VERSION }}
body_path: commit_messages.txt
draft: false
prerelease: true
Expand All @@ -78,5 +83,5 @@ jobs:
"@context": "http://schema.org/extensions",
"themeColor": "0078D7",
"title": "New Pre-release Published",
"text": "A new pre-release version $(node -p "require('./package.json').version") has been published to npm."
"text": "A new pre-release version ${{ env.VERSION }} has been published to npm."
}' $TEAMS_WEBHOOK_URL

0 comments on commit e9ca57f

Please sign in to comment.