Add GitHub Actions workflow for publishing plugin
- Introduced a new workflow file (.github/workflows/publish.yml) to automate the publishing process for the plugin. - Configured jobs for testing and publishing to NPM upon version tag pushes. - Included steps for dependency installation, plugin building, and verification before publishing. - Ensured integration tests are run in the playground environment before publishing the plugin.
This commit is contained in:
@@ -5,15 +5,19 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Tests
|
name: Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: "npm"
|
cache: "npm"
|
||||||
@@ -45,14 +49,14 @@ jobs:
|
|||||||
run: npm run test:integration
|
run: npm run test:integration
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: Publish to NPM
|
name: Publish to NPM (Trusted Publisher)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: test
|
needs: test
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
registry-url: https://registry.npmjs.org/
|
registry-url: https://registry.npmjs.org/
|
||||||
@@ -60,16 +64,9 @@ jobs:
|
|||||||
cache-dependency-path: package-lock.json
|
cache-dependency-path: package-lock.json
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Clean build artifacts
|
|
||||||
run: rm -rf dist
|
|
||||||
- name: Build plugin
|
- name: Build plugin
|
||||||
run: npm run build
|
run: npm run build
|
||||||
- name: Verify plugin
|
- name: Verify plugin
|
||||||
run: npm run verify
|
run: npm run verify
|
||||||
- name: Clean workspace for publish
|
|
||||||
run: |
|
|
||||||
rm -rf playground tests admin server node_modules .gitea .github
|
|
||||||
- name: Publish
|
- name: Publish
|
||||||
run: npm publish
|
run: npm publish
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
Reference in New Issue
Block a user