-
Notifications
You must be signed in to change notification settings - Fork 25
87 lines (83 loc) · 2.87 KB
/
linux-build.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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: linux-build
on: [push]
jobs:
build:
strategy:
matrix:
compiler:
- g++-8
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: akhilmhdh/[email protected]
if: ${{ !startsWith(github.ref, 'refs/tags') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- name: build
run: |
npm install
npm run build
- name: extract version
id: version
run: |
echo "##[set-output name=version;]${GITHUB_REF#$"refs/tags/v"}"
- name: upload
id: upload
uses: actions/upload-artifact@v2
with:
name: ubuntu-build
path: ./build/Civet-${{ steps.version.outputs.version }}.AppImage
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: test
run: |
sudo apt-get install xvfb
npm install
xvfb-run --auto-servernum npm run test --loglevel silly
env:
CI: true
publish:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags')
steps:
- name: extract version
id: version
run: |
echo "##[set-output name=version;]${GITHUB_REF#$"refs/tags/v"}"
echo "##[set-output name=version_tag;]$GITHUB_REPOSITORY:${GITHUB_REF#$"refs/tags/v"}"
echo "##[set-output name=latest_tag;]$GITHUB_REPOSITORY:latest"
- name: prepare env
run: |
echo VERSION_TAG=$(echo ${{ steps.version.outputs.version_tag }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
echo LASTEST_TAG=$(echo ${{ steps.version.outputs.latest_tag }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: get Release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: view cache
uses: actions/download-artifact@v2
with:
name: ubuntu-build
path: ~/download/
- name: upload linux artifact
env:
GITHUB_TOKEN: ${{ github.token }}
CI: true
FILE: /home/runner/download/Civet-${{ steps.version.outputs.version }}.AppImage
run: |
curl -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: $(file -b --mime-type $FILE)" --data-binary @$FILE "https://uploads.github.com/repos/webbery/civet/releases/${{ steps.get_release.outputs.id }}/assets?name=$(basename $FILE)"