Skip to content

Commit 8daebec

Browse files
build in release
1 parent ffb254e commit 8daebec

1 file changed

Lines changed: 41 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: Release
22

33
on:
4-
# push:
5-
# branches: [main]
6-
74
workflow_dispatch:
85
inputs:
96
dry-run:
@@ -30,9 +27,44 @@ concurrency:
3027

3128

3229
jobs:
33-
release:
34-
uses: cap-js/.github/.github/workflows/release.yml@main
35-
secrets: inherit
36-
with:
37-
dry-run: ${{ github.event.inputs.dry-run == 'true' }}
38-
tag: ${{ github.event.inputs.tag || 'latest'}}
30+
publish-npm:
31+
runs-on: ubuntu-latest
32+
environment: npm
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- uses: actions/setup-node@v4
37+
with:
38+
node-version: 22
39+
registry-url: https://registry.npmjs.org/
40+
41+
- name: Run Unit Tests
42+
run: |
43+
npm ci
44+
npm run test
45+
46+
- name: Run Build
47+
run: npm run build
48+
49+
- name: Publish to npm
50+
run: npm publish --tag ${{ github.event.inputs.tag || 'latest' }} --access public --provenance ${{ github.event.inputs.dry-run == 'true' && '--dry-run' || '' }}
51+
env:
52+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
53+
54+
- name: Get Version
55+
id: get-version
56+
run: |
57+
echo "version=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
58+
59+
- name: Parse CHANGELOG.md
60+
id: parse-changelog
61+
uses: schwma/parse-changelog-action@v1.0.0
62+
with:
63+
version: '${{ steps.get-version.outputs.version }}'
64+
title-regex: '^##\s+\[\d.*$'
65+
66+
- name: Create a GitHub release
67+
if: ${{ github.event.inputs.dry-run != 'true' }}
68+
uses: ncipollo/release-action@v1
69+
with:
70+
tag: 'v${{ steps.get-version.outputs.version }}'

0 commit comments

Comments
 (0)