Skip to content

Commit f8d1919

Browse files
committed
Add release workflow
1 parent e18ef41 commit f8d1919

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

.github/workflows/publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
8+
env:
9+
NODE_VERSION: 20
10+
PNPM_VERSION: 9
11+
12+
jobs:
13+
publish-js:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 5
16+
17+
steps:
18+
- name: Checkout project
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ env.NODE_VERSION }}
25+
26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@v4.0.0
28+
with:
29+
version: ${{ env.PNPM_VERSION }}
30+
run_install: true
31+
32+
- name: Publish
33+
shell: bash
34+
env:
35+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
run: |
37+
# Read the current version from package.json
38+
CURRENT_VERSION=$(jq -r '.version' ./package.json)
39+
40+
# Check if the version contains "-beta"
41+
if [[ "$CURRENT_VERSION" == *"-beta"* ]]; then
42+
echo "Publishing $CURRENT_VERSION as beta tag"
43+
pnpm publish --access public --tag beta
44+
else
45+
echo "Publishing $CURRENT_VERSION as latest tag"
46+
pnpm publish --access public
47+
fi

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
22
"name": "@caido-community/create-plugin",
3-
"version": "1.0.0",
4-
"description": "",
3+
"version": "0.0.1",
4+
"description": "Initializer for Caido plugins",
55
"bin": {
66
"create-plugin": "./dist/index.mjs"
77
},
88
"scripts": {
99
"build": "unbuild"
1010
},
1111
"files": [
12-
"dist"
12+
"dist",
13+
"templates"
1314
],
1415
"engines": {
1516
"node": "^18.0.0 || >=20.0.0"

0 commit comments

Comments
 (0)