-
-
Notifications
You must be signed in to change notification settings - Fork 194
173 lines (145 loc) · 5.33 KB
/
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
name: Publish new release
on:
workflow_dispatch:
inputs:
release-type:
type: choice
description: Select the release type
required: true
options:
- patch
- minor
jobs:
ensure-changes:
name: Ensure there are changes
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to get all existing tags
fetch-tags: true
- name: Stop if there are no new changes
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 --always)
LAST_COMMIT=$(git rev-parse HEAD)
LASTEST_TAG_COMMIT=$(git rev-list -n 1 $LATEST_TAG)
if [ "$LASTEST_TAG_COMMIT" == "$LAST_COMMIT" ]; then
echo "No new changes since the last tag. Stopping the workflow."
exit 1
fi
exit 0
build-macos:
name: Build macOS
runs-on: macos-latest
needs: ensure-changes
steps:
- name: Install Apple certificate
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_APPLICATION_CERTIFICATE }}
P12_PASSWORD: ${{ secrets.APPLE_P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Create new version
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
npm version ${{ github.event.inputs.release-type }} -m "chore: v%s"
- name: Package and create release
run: |
npm install
npm run build
npm run package -- --mac --publish always
env:
STEAM_API_KEYS: ${{ secrets.STEAM_API_KEYS }}
FACEIT_API_KEY: ${{ secrets.FACEIT_API_KEY }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
build-linux:
name: Build Linux
runs-on: ubuntu-latest
needs: ensure-changes
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Create new version
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
npm version ${{ github.event.inputs.release-type }} -m "chore: v%s"
- name: Package and create release
run: |
npm install
npm run build
npm run package -- --linux --publish always
env:
STEAM_API_KEYS: ${{ secrets.STEAM_API_KEYS }}
FACEIT_API_KEY: ${{ secrets.FACEIT_API_KEY }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
build-windows:
name: Build Windows
runs-on: windows-latest
needs: ensure-changes
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Create new version
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
npm version ${{ github.event.inputs.release-type }} -m "chore: v%s"
- name: Package and create release
run: |
npm install
npm run build
npm run package -- --win --publish always
env:
STEAM_API_KEYS: ${{ secrets.STEAM_API_KEYS }}
FACEIT_API_KEY: ${{ secrets.FACEIT_API_KEY }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
publish-on-github:
name: Publish on GitHub
runs-on: ubuntu-latest
needs: [build-macos, build-linux, build-windows]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Create new version
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
npm version ${{ github.event.inputs.release-type }} -m "chore: v%s"
- name: Push the tag to GitHub
run: git push origin main --tags