Files
simapi-vue/.github/workflows/publish.yml
T
2026-03-31 06:46:34 +08:00

50 lines
1.1 KiB
YAML

name: Publish to npm
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Get version from tag
id: version
run: echo "version=$(echo $GITHUB_REF | sed 's/refs\/tags\///')" >> $GITHUB_OUTPUT
- name: Update package.json version
run: npm pkg set version=${{ steps.version.outputs.version }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Publish to npm
run: npm publish --access public
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
body: |
## @simcu/simapi v${{ steps.version.outputs.version }}
See [changelog](https://github.com/simcu/simapi-vue/releases) for details.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}