Skip to content

Commit caa9f79

Browse files
authored
Merge pull request #32 from chetasr/ci/add-publish-workflow
update workflow
2 parents d12c1f5 + c7760ed commit caa9f79

File tree

3 files changed

+49
-69
lines changed

3 files changed

+49
-69
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,20 @@ on:
77
branches: [main, develop]
88

99
jobs:
10-
build:
10+
lint:
1111
runs-on: ubuntu-latest
12-
13-
steps:
14-
- uses: actions/checkout@v3
15-
- name: Set up Node 22.19.0
16-
uses: actions/setup-node@v4
17-
with:
18-
node-version: '22.19.0'
19-
cache: 'npm'
20-
registry-url: 'https://registry.npmjs.org'
21-
22-
- name: Install dependencies
23-
run: npm clean-install
24-
env:
25-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
26-
27-
- name: Lint code with standard
28-
run: npm run lint
12+
name: Lint
13+
steps:
14+
- uses: tetherto/oss-actions/node-base@v1
15+
- run: npm run lint
16+
test:
17+
strategy:
18+
matrix:
19+
include:
20+
- os: ubuntu-latest
21+
platform: linux
22+
runs-on: ${{ matrix.os }}
23+
name: Test / ${{ matrix.platform }}
24+
steps:
25+
- uses: tetherto/oss-actions/node-base@v1
26+
- run: npm test
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release to public npm
2+
on:
3+
pull_request:
4+
types: [closed]
5+
branches:
6+
- main
7+
jobs:
8+
approve-release:
9+
if: "${{ github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'Release: ') }}"
10+
runs-on: ubuntu-latest
11+
environment: release
12+
permissions:
13+
contents: write
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
17+
with:
18+
persist-credentials: false
19+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
20+
with:
21+
node-version: lts/*
22+
registry-url: 'https://registry.npmjs.org'
23+
- run: |
24+
VERSION=$(node -p "require('./package.json').version")
25+
npm version $VERSION --no-git-tag-version --allow-same-version
26+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
27+
if ! git ls-remote --tags origin | grep -q "refs/tags/v$VERSION$"; then
28+
git tag "v$VERSION"
29+
git push origin "v$VERSION"
30+
fi
31+
npm publish --access public --provenance --tag latest --ignore-scripts
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)