Skip to content

Commit e09d222

Browse files
ci: publish via ci, automate changelog, provenance (#499)
1 parent 045bcef commit e09d222

File tree

6 files changed

+2142
-214
lines changed

6 files changed

+2142
-214
lines changed

.github/workflows/check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ jobs:
77
- uses: actions/checkout@v3
88
- uses: actions/setup-node@v3
99
with:
10-
node-version: 18
10+
node-version: 20
11+
cache: 'npm'
1112
- name: run eslint
1213
run: |
1314
npm ci

.github/workflows/publish.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: publish
2+
on:
3+
workflow_dispatch: {}
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'package.json'
9+
- 'package-lock.json'
10+
- 'tsconfig.json'
11+
- 'tsconfig.build.json'
12+
- 'src/*'
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
id-token: write
18+
19+
jobs:
20+
release:
21+
outputs:
22+
release_created: ${{ steps.release.outputs.release_created }}
23+
version: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: google-github-actions/release-please-action@v3
27+
id: release
28+
with:
29+
release-type: node
30+
package-name: 'pg-error-enum'
31+
bump-minor-pre-major: true
32+
bump-patch-for-minor-pre-major: true
33+
34+
publish:
35+
if: ${{ needs.release.outputs.release_created }}
36+
needs: [release]
37+
runs-on: ubuntu-latest
38+
environment:
39+
name: NPM
40+
url: https://www.npmjs.com/package/pg-error-enum/v/${{ needs.release.outputs.version }}
41+
steps:
42+
- uses: actions/checkout@v3
43+
with:
44+
fetch-depth: 0
45+
- uses: actions/setup-node@v3
46+
with:
47+
node-version: 18
48+
registry-url: 'https://registry.npmjs.org'
49+
cache: 'npm'
50+
- run: npm ci
51+
- env:
52+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
53+
run: npm publish --provenance --access public

.github/workflows/sync.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
ssh-key: ${{ secrets.ACTION_DEPLOY_KEY }}
1515
- uses: actions/setup-node@v3
1616
with:
17-
node-version: 18
17+
node-version: 20
18+
cache: 'npm'
1819
- run: npm ci
1920
- run: npm run sync
2021
- name: git config

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
- uses: actions/setup-node@v3
99
with:
1010
node-version: 20
11+
cache: 'npm'
1112
- name: Install deps, build, then clear deps
1213
run: |
1314
npm ci

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
dist
2+
CHANGELOG.md

0 commit comments

Comments
 (0)