-
-
Notifications
You must be signed in to change notification settings - Fork 7
180 lines (156 loc) · 4.83 KB
/
build_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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Build and Publish
on:
push:
tags:
- 'v*.*.*'
branches:
- master
jobs:
update_dev_tag:
name: Update dev tag
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'master' }}
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Update tag
run: |
export OWNER=$(echo $GITHUB_REPOSITORY | cut -d/ -f1)
git config --global user.name 'Github Action'
git config --global user.email $OWNER@users.noreply.github.com
git tag -f v0.0.0
git push -f origin v0.0.0
prepare_release:
name: Prepare Release
runs-on: ubuntu-latest
steps:
- name: Derive correct Tag
id: derive_tag_name
run: |
if [ $GITHUB_REF_NAME == "master" ]; then
echo "::set-output name=tag_name::v0.0.0"
else
echo "::set-output name=tag_name::$GITHUB_REF_NAME"
fi
- name: Release
if: ${{ github.ref_name != 'master' }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.derive_tag_name.outputs.tag_name }}
prerelease: true
outputs:
tag: ${{ steps.derive_tag_name.outputs.tag_name }}
build:
name: App build
needs: [ prepare_release ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Install Node.js and NPM
uses: actions/setup-node@v2
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
- name: Update version in package.json
run: |
cd app
npm version ${{ needs.prepare_release.outputs.tag }} --allow-same-version
- name: Build AskSinAnalyzerXS UI
run: |
cd ui
npm ci
npm run build
- name: Build AskSinAnalyzerXS
run: |
cd app
npm ci
npm run tsc
- name: Create NPM bundle
if: runner.os == 'Linux'
run: |
cd app
node scripts/make-node-pkg.js
- name: Publish NPM bundle
if: runner.os == 'Linux' && needs.prepare_release.outputs.tag != 'v0.0.0'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_TOKEN }}
run: |
cd builds/asksin-analyzer-xs-*-node
npm publish
- name: Build Electron App
uses: samuelmeuli/action-electron-builder@v1
with:
package_root: app
github_token: ${{ secrets.github_token }}
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.prepare_release.outputs.tag }}
fail_on_unmatched_files: false
files: |
builds/asksin-analyzer-xs-*-node.tar.gz
builds/asksin-analyzer-xs-*-win.*
builds/asksin-analyzer-xs-*-mac.*
builds/asksin-analyzer-xs-*-linux.*
build_docker:
name: Docker build
runs-on: ubuntu-latest
steps:
- name: Derive docker tag
id: vars
run: |
if [ $GITHUB_REF_NAME == "master" ]; then
echo "::set-output name=tag::latest"
else
echo "::set-output name=tag::${GITHUB_REF_NAME:1}"
fi
- name: Checkout
uses: actions/checkout@v2
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/#-action@v1
with:
username: psitrax
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/#-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
uses: docker/build-push-action@v2
env:
DOCKER_TAG: ${{ steps.vars.outputs.tag }}
with:
file: Docker/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
psitrax/asksinanalyzer:${{ steps.vars.outputs.tag }}
ghcr.io/psi-4ward/asksinanalyzerxs:${{ steps.vars.outputs.tag }}
publish_release:
name: Publish Release
if: ${{ github.ref_name != 'master' }}
runs-on: ubuntu-latest
needs: [ build ]
steps:
- name: Create Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitMode: true
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: false
body: ${{ needs.prepare_release.outputs.tag }}