-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (64 loc) · 2.4 KB
/
build-extension.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
name: Build extension
on:
workflow_call:
inputs:
host:
required: true
type: string
jobs:
browser-extension:
name: Build extension for ${{ inputs.host }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'npm'
- run: |
npm c set fetch-retry-maxtimeout 180000
npm ci
- name: Build apps
run: |
npm -w packages/app run clean
npm -w packages/app run build-extension
test "${GITHUB_REF#refs/heads/}" != "main" && (cd packages/app/ && node scripts/beta_manifest.mjs) || echo 'No manifest modification.'
env:
LC_WS_URL: wss://${{ inputs.host }}/app
LC_API_URL: https://${{ inputs.host }}/api
NODE_OPTIONS: "--max-old-space-size=4096"
- name: Create release directory tree
run: |
mkdir -p build/apps/
cp -a packages/app/dist/bundle/extension build/apps/browser-extension
shell: bash
- name: Archive apps
uses: ihiroky/archive-action@v1
with:
file_path: build/browser-extension-${{ inputs.host }}-${{ github.run_number }}.zip
root_dir: build/apps/browser-extension
- name: Gets latest release info
id: latest_release
uses: octokit/request-action@v2.x
with:
route: GET /repos/ihiroky/live-comment/releases?per_page=1&page=1
owner: octokit
repo: request-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload asset to github release if draft release exists.
id: upload-release-asset
if: ${{ fromJson(steps.latest_release.outputs.data)[0].draft == true }}
uses: ihiroky/upload-release-asset@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ fromJson(steps.latest_release.outputs.data)[0].upload_url }}
asset_path: build/browser-extension-${{ inputs.host }}-${{ github.run_number }}.zip
asset_name: browser-extension-${{ inputs.host }}-${{ github.run_number }}.zip
asset_content_type: application/zip
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: browser-extension-${{ inputs.host }}-${{ github.run_number }}
path: build/apps/browser-extension/