-
Notifications
You must be signed in to change notification settings - Fork 6
76 lines (69 loc) · 2.67 KB
/
build-and-release.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
name: Build & Release
on:
push:
tags:
- desktop-*
workflow_dispatch:
inputs:
debugElectronBuilder:
description: 'Verbose electron-builder output'
required: true
type: choice
options:
- 'false'
- 'true'
stage:
description: 'Environment to release the app for'
required: true
type: choice
options:
- alpha
- beta
- prod
jobs:
setup:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/desktop')
outputs:
version: ${{ steps.set_outputs.outputs.version }}
stage: ${{ steps.set_outputs.outputs.stage }}
release_name: ${{ steps.set_outputs.outputs.release_name }}
steps:
- id: set_outputs
name: Set outputs for version, release name, and stage
run: |
VERSION=${GITHUB_REF#refs/*/desktop-}
STAGE=$(echo $VERSION | perl -0777 -pe 's/^([0-9]\d*\.[0-9]\d*\.[0-9]\d*)(?:-([a-z]*)-([0-9]\d*(\.[0-9]\d*)*))?$/$2/')
RELEASE_NAME=$(echo $VERSION | perl -0777 -pe 's/^([0-9]\d*\.[0-9]\d*\.[0-9]\d*)(?:-([a-z]*)-(\d*))?$/$1 \u$2 $3/')
if [ -z "$STAGE" ]; then
STAGE="prod"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "stage=$STAGE" >> $GITHUB_OUTPUT
echo "release_name=$RELEASE_NAME" >> $GITHUB_OUTPUT
trigger-build:
name: Build (Trigger) - ${{ matrix.os }}
uses: ./.github/workflows/reusable_build.yml
if: ${{ always() }}
needs: [setup]
strategy:
matrix:
os: [ubuntu-20.04, windows-2022, macos-11]
fail-fast: true
with:
os: ${{ matrix.os }}
version: ${{ needs.setup.outputs.version }}
stage: ${{ inputs.stage || needs.setup.outputs.stage }}
sign: true
upload: true
secrets: inherit
trigger-release:
name: Release (Trigger) - ${{ needs.setup.outputs.version }} (${{ inputs.stage || needs.setup.outputs.stage }})
uses: ./.github/workflows/reusable_release.yml
needs: [setup, trigger-build]
if: ${{ startsWith(github.ref, 'refs/tags/desktop') }}
with:
version: ${{ needs.setup.outputs.version }}
stage: ${{ inputs.stage || needs.setup.outputs.stage }}
release_name: ${{ needs.setup.outputs.release_name }}
secrets: inherit