From f203be32d818a58ec852747d0ad1de252ea1c1c4 Mon Sep 17 00:00:00 2001 From: Jujuyeh Date: Thu, 29 Feb 2024 16:33:05 +0100 Subject: [PATCH] Add CI/CD for NPM --- .DS_Store | Bin 6148 -> 0 bytes .github/workflows/release.yaml | 44 +++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) delete mode 100644 .DS_Store create mode 100644 .github/workflows/release.yaml diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index fd2f2b68dffd3593df4ae8beca35f859712f6557..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK&2G~`5T0!Uar&nmiUbEFOI$-pN~namxM^~z1RQDv2SCA&Loju{QS3BAQKa1A z8F&TGya?~Y3BLV_WIN3fMA444`|Z!ntmm7}ZkC8xXBxDKYD8qA2rO@-xT(~6wr_^PowPbmwm=eXEkC6pHQ?qc?9 zMsItiNB1eEPc(+_q+s*2U{iwU3mWCM=orV!e#W!b@@L6dpEKY6aTF$Lv-yK=``thlh>m6g7e5c?ZZ~xZaq4BxTxFn$A`_j-9BnB7FFxky$4Uu`sdL_%msN6 zhGS96p2ih?K|_ag=}zK^$0Ljg?Fv1mQ#zp@JtvoX>y+e@vP&^>nZ7;<6s;*mR}e0e zluhO?(&Ev8&QXt`-=L33EvGoY9utYm+8u1NL$b#-fhX;^;HS7rs&s}3kEu(~fDL?m zkhh?3g_TSAz6lKqTG%4F&9{dwmmn@gLhrGuMjIm&8OmVJ6=GOKum?AVwZs=? zEzrH*qBp0tbG^ebUvC&N4EzBG#Q9*O2y`?q70ROnm3#sK%NUk|w*2!Cw8a3>(YREI z5eQSJKxNAG6NBlu15@UhceMUep)w~XSB4+GGSe>YDg{C$P7zXkTlvKAS z?*HEA_kZ5V^b7-rf&YpDR_?mp4nop*>soN)uC-C#p$HLrONG(|mA;N;LtMqTQKVqb Y77d`Iaj6g^5c5Ys(qJmXz+YwHH~v5AoB#j- diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..4532b62 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,44 @@ +name: release +on: + push: + branches: + - main + workflow_dispatch: {} +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set git identity + run: |- + git config user.name "github-actions" + git config user.email "github-actions@github.com" + - name: Check whether it's the latest commit + run: if [[ $(git ls-remote origin -h ${{ github.ref }} | cut -f1) != ${{ github.sha }} ]]; then exit 1; fi + - name: Setup Node.js + uses: actions/setup-node@v3.8.2 + with: + node-version: 14 + - name: Install dependencies + run: npm ci + - name: Build + run: npm run build + - name: Run standard-version + run: npm run release + - name: Push new changelog to git + run: git push --follow-tags + - name: Release to GitHub releases + 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 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_REF: ${{ github.ref }} + - name: Setup NPM registry + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc + - name: Release to NPM + run: npm publish --access public \ No newline at end of file diff --git a/package.json b/package.json index c19f5dc..3e8a324 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sysdig/backstage-plugin-sysdig", - "version": "0.0.0", + "version": "1.0.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0",