-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (80 loc) · 2.13 KB
/
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
74
75
76
77
78
79
80
81
82
83
84
name: Publish
on:
push:
tags:
- "**"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: "npm"
node-version: 20.10.0
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Docs
run: npm run generate:docs
- uses: actions/upload-artifact@v3
if: success()
with:
name: latest
path: dist
publish:
name: Publish
needs: build
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: "npm"
node-version: 20.10.0
registry-url: https://registry.npmjs.org/
- uses: actions/download-artifact@v3
with:
name: latest
path: dist
- name: Configure git
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Configure npm
run: npm config set //registry.npmjs.org/:_authToken ${{secrets.WCP_NPM_TOKEN}}
- name: Publish package
run: npx release-it --no-git --no-github.release --no-increment --ci
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.WCP_NPM_TOKEN}}
deploy:
name: Deploy
needs: build
environment:
name: Preview
url: https://webcomponents-preview.github.io/client/latest/
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: deploy
token: ${{secrets.WCP_GITHUB_TOKEN}}
- uses: actions/download-artifact@v3
with:
name: latest
path: .tmp
- name: Configure git
run: |
git config user.name "autoreleaser"
git config user.email "[email protected]"
- name: Update latest
run: |
rm -rf latest
mv .tmp latest
git add .
git commit --allow-empty --message $GITHUB_SHA
git push