mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-28 07:36:38 +08:00
49 lines
1.3 KiB
YAML
49 lines
1.3 KiB
YAML
name: Publish Skill to npm
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- 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: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
VERSION=$(node -p "require('./skills/flvx-api/package.json').version")
|
|
else
|
|
VERSION="${GITHUB_REF#refs/tags/v}"
|
|
fi
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "Publishing skill version: $VERSION"
|
|
|
|
- name: Publish to npm
|
|
working-directory: skills/flvx-api
|
|
run: npm publish --provenance --access public
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Create GitHub Release
|
|
if: github.event_name == 'push'
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
name: Skill v${{ steps.version.outputs.version }}
|
|
generate_release_notes: true
|
|
files: skills/flvx-api/package.json
|