-
Notifications
You must be signed in to change notification settings - Fork 21
80 lines (66 loc) · 2.1 KB
/
build-test.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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests
name: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types:
- published
permissions:
contents: write
jobs:
build-and-test:
name: Build zui
env:
CI: ""
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build app
run: npm run build
- name: Package app
run: tar -czvf /tmp/zui.tgz ./build
- name: Publish artifacts on releases
if: github.event_name == 'release' && github.event.action == 'published'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /tmp/zui.tgz
tag: ${{ github.ref }}
overwrite: true
- name: Generate commit sha
if: github.ref_name == 'main'
uses: benjlevesque/[email protected]
# This creates and environment variable SHA containing the short commit ID
- name: Create new tag for builds on main branch
if: github.ref_name == 'main'
uses: mathieudutour/[email protected]
with:
custom_tag: commit-${{ env.SHA }}
tag_prefix: ""
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish artifact for builds on main branch
if: github.ref_name == 'main'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /tmp/zui.tgz
tag: commit-${{ env.SHA }}
prerelease: true # Mark as prerelease and avoid triggering another workflow for the new tag
overwrite: true