Skip to content

Commit f203be3

Browse files
committed
Add CI/CD for NPM
1 parent a4ef86f commit f203be3

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

.DS_Store

-6 KB
Binary file not shown.

.github/workflows/release.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch: {}
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
- name: Set git identity
18+
run: |-
19+
git config user.name "github-actions"
20+
git config user.email "github-actions@github.com"
21+
- name: Check whether it's the latest commit
22+
run: if [[ $(git ls-remote origin -h ${{ github.ref }} | cut -f1) != ${{ github.sha }} ]]; then exit 1; fi
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v3.8.2
25+
with:
26+
node-version: 14
27+
- name: Install dependencies
28+
run: npm ci
29+
- name: Build
30+
run: npm run build
31+
- name: Run standard-version
32+
run: npm run release
33+
- name: Push new changelog to git
34+
run: git push --follow-tags
35+
- name: Release to GitHub releases
36+
run: errout=$(mktemp); gh release create $(cat package.json | jq -r .version) -R $GITHUB_REPOSITORY -F CHANGELOG.md -t $(cat package.json | jq -r .version) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
GITHUB_REPOSITORY: ${{ github.repository }}
40+
GITHUB_REF: ${{ github.ref }}
41+
- name: Setup NPM registry
42+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
43+
- name: Release to NPM
44+
run: npm publish --access public

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sysdig/backstage-plugin-sysdig",
3-
"version": "0.0.0",
3+
"version": "1.0.0",
44
"main": "src/index.ts",
55
"types": "src/index.ts",
66
"license": "Apache-2.0",

0 commit comments

Comments
 (0)