-
Notifications
You must be signed in to change notification settings - Fork 32
63 lines (53 loc) · 1.78 KB
/
webcomponents.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
name: Artifacts
run-name: 🧩 Build Web Components for ${{ github.event_name == 'issue_comment' && 'PR' || (github.event_name == 'release' && '🏷' || '🌱') }} ${{github.event_name == 'issue_comment' && github.event.issue.number || github.ref_name}}
# This workflow runs whenever a commit is pushed on main or a release is published
on:
push:
branches:
- main
release:
types: [published]
concurrency:
group: webcomponents-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: 16.17.0
PUBLISH_BRANCH: wc-dist
jobs:
build-publish-script:
name: Build and publish the Web Components
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ needs.checks.outputs.ref }}
persist-credentials: false
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build webcomponents script
run: |
mkdir wc-dist
npm run build:demo
mv dist/demo/webcomponents/gn-wc.js wc-dist
- name: Upload archives to release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: wc-dist/gn-wc.js
tag: ${{ github.ref }}
overwrite: true
- name: Publish web component to ${{ env.PUBLISH_BRANCH }} branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
publish_dir: ./wc-dist
publish_branch: ${{ env.PUBLISH_BRANCH }}