Skip to content

Workflow file for this run

name: Update Version and Publish
on:
release:
types: [created]
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.release.target_commitish }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm ci
- name: Extract version from release
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Update version.ts
run: |
echo "export const VERSION = \"$VERSION\";" > common/version.ts
- name: Update package.json version
run: npm version $VERSION --no-git-tag-version
- name: Build
run: npm run build
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add common/version.ts package.json
git commit -m "chore: update version to $VERSION [skip ci]"
git push
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}