Skip to content

Commit c6aec7a

Browse files
committed
Add an API publish workflow
1 parent e4751fa commit c6aec7a

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

.github/workflows/publish-api.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Publish Workers API
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'api/**'
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
publish:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
registry-url: 'https://registry.npmjs.org/'
26+
27+
- name: Create npmrc
28+
working-directory: ./api
29+
env:
30+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
31+
NPM_EMAIL: npm@jfrog.com
32+
run: |
33+
echo "Creating npmrc for publish"
34+
cat > .npmrc << EOF
35+
always-auth=true
36+
email=${NPM_EMAIL}
37+
registry=https://registry.npmjs.org/
38+
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
39+
EOF
40+
cat .npmrc
41+
echo "Creating npmrc done"
42+
43+
- name: Install dependencies
44+
working-directory: ./api
45+
run: npm install --no-progress
46+
47+
- name: Update minor version
48+
working-directory: ./api
49+
run: npm version minor --no-git-tag-version
50+
51+
- name: Build
52+
working-directory: ./api
53+
run: npm run build
54+
55+
- name: Publish to npm
56+
working-directory: ./api
57+
run: |
58+
echo "Publishing API npm package"
59+
npm publish
60+
echo "Publishing API npm package done"

api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jfrog-workers",
3-
"version": "0.9.0",
3+
"version": "0.8.0",
44
"description": "JFrog workers interfaces",
55
"homepage": "https://github.com/jfrog/workers-sample",
66
"contributors": [

0 commit comments

Comments
 (0)