generated from christian-bromann/typescript-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (69 loc) · 2.37 KB
/
npm-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Manual NPM Publish
on:
workflow_dispatch:
inputs:
releaseType:
description: "Release type - major, minor or patch"
required: true
type: choice
default: "patch"
options:
- patch
- minor
- major
additionalFlags:
description: "Additional flags for pre-releases, e.g. '--dry-run', '--preRelease=beta' or '--preRelease'"
required: false
type: string
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Setup Node version
uses: actions/setup-node@v1
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Build Package
run: npm run build
env:
NODE_ENV: production
- name: Run tests
run: npm test
- name: Upload built package
uses: actions/upload-artifact@v4
with:
name: compiled-package
path: build/
release:
needs: test
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Setup Node version
uses: actions/setup-node@v2
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Setup Git
run: |
git config --global user.name "stateful-wombot"
git config --global user.email "[email protected]"
- name: Install dependencies
run: npm install
- name: Download built package
uses: actions/download-artifact@v4
with:
name: compiled-package
path: build/
- name: Release
run: npm run release:ci -- ${{github.event.inputs.releaseType}} ${{github.event.inputs.additionalFlags}}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}