Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update publish workflow #122

Merged
merged 1 commit into from
Jun 24, 2024
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
20 changes: 13 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,35 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: git config --global user.email "wuergler@gmail.com"
- run: git config --global user.name "Michael Wuergler"
- run: npm ci
- name: Extract version from tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- run: npm version ${{ env.RELEASE_VERSION }}
- run: npm version ${{ env.RELEASE_VERSION }} --no-git-tag-version
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Commit and push version bump
run: |
git add package.json
git commit -m "chore: bump version to ${{ env.RELEASE_VERSION }}"
git push origin HEAD:${{ env.GITHUB_REF#refs/tags/ }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# This step will only run if all previous steps have succeeded
- name: Create Pull Request for Version Bump
if: success()
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update package version
title: 'chore: update package version to ${{ env.RELEASE_VERSION }}'
body: 'Updates `package.json` version to `${{ env.RELEASE_VERSION }}`.'
commit-message: Update package version to ${{ env.RELEASE_VERSION }}
title: "chore: update package version to ${{ env.RELEASE_VERSION }}"
body: "Updates `package.json` version to `${{ env.RELEASE_VERSION }}`."
branch: version-bump/${{ env.RELEASE_VERSION }}
labels: version-bump
token: ${{ secrets.GITHUB_TOKEN }}
base: master

Loading