v0.0.1-alpha-01 #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Package to npmjs | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
registry-url: "https://registry.npmjs.org" | |
cache: "npm" | |
- run: git config --global user.email "[email protected]" | |
- 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 }} --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 checkout -b version-bump/${{ env.RELEASE_VERSION }} | |
git add package.json | |
git commit -m "chore: bump version to ${{ env.RELEASE_VERSION }}" | |
git push origin version-bump/${{ env.RELEASE_VERSION }} | |
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 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: main |