-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (75 loc) · 2.25 KB
/
publish-package.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# This workflow will run tests using node and then publish a package to GitHub Packages when a tag is pushed
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Publish Package
on:
push:
tags: ['*']
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Node 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Write .npmrc file
run: |
echo //npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }} > $HOME/.npmrc
echo @rundown-studio:registry=https://npm.pkg.github.com >> $HOME/.npmrc
- name: Install Dependencies
run: npm ci --loglevel=error
- name: Compile Typescript
run: npm run build
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Node 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Write .npmrc file
run: |
echo //npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }} > $HOME/.npmrc
echo @rundown-studio:registry=https://npm.pkg.github.com >> $HOME/.npmrc
- name: Install Dependencies
run: npm ci --loglevel=error
- name: Run Unit Tests
run: npm run test:ci
env:
NODE_OPTIONS: --experimental-vm-modules
publish:
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Node 20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
- name: Publish Package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}