Skip to content

v0.0.12

v0.0.12 #17

Workflow file for this run

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 "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
- name: Check for pre-release
id: check_pre_release
run: |
if [[ "${{ env.RELEASE_VERSION }}" == *-* ]]; then
echo "IS_PRE_RELEASE=true" >> $GITHUB_ENV
echo "RELEASE_TAG=next" >> $GITHUB_ENV
else
echo "IS_PRE_RELEASE=false" >> $GITHUB_ENV
echo "RELEASE_TAG=latest" >> $GITHUB_ENV
fi
- run: npm version ${{ env.RELEASE_VERSION }} --no-git-tag-version
- run: npm run build
- name: Publish to npm
run: npm publish --tag ${{ env.RELEASE_TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Commit and push version bump
if: env.IS_PRE_RELEASE == 'false'
run: |
git checkout -b version-bump/${{ env.RELEASE_VERSION }}
git add package.json package-lock.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 }}