forked from Chatterino/chatterino2
-
Notifications
You must be signed in to change notification settings - Fork 71
188 lines (162 loc) · 6.11 KB
/
create-installer.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
181
182
183
184
185
186
187
188
name: Create installer
on:
workflow_run:
workflows: ["Build"]
types: [completed]
# make sure this only runs on the default branch
branches: [chatterino7, "bugfix-release/**", "release/*"]
workflow_dispatch:
env:
C2_PORTABLE_INSTALLER_VERSION: "v0.1.3"
C2_PORTABLE_INSTALLER_SHA256: "1226165a328e9b1ce96ccc1b3a641fe9020708b5e2f88a486e226e2b4f259aa8"
RELEASE_NIGHTLY_INSTALLER: "OFF"
jobs:
create-installer:
runs-on: windows-latest
# Only run manually or when a build succeeds
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
qt-version: ["6.7.3"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # allows for tags access
- name: Download artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yml
name: chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}.zip
commit: ${{ github.sha }}
path: build/
- name: Unzip
run: 7z e -spf chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}.zip
working-directory: build
- name: Install InnoSetup
run: choco install innosetup
- name: Add InnoSetup to path
run: echo "C:\Program Files (x86)\Inno Setup 6\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Enable Developer Command Prompt
uses: ilammy/[email protected]
- name: Build installer
id: build-installer
working-directory: build
run: ..\.CI\build-installer.ps1
shell: powershell
- name: Bundle portable
id: bundle-portable
working-directory: build
run: ..\.CI\bundle-portable.ps1
shell: powershell
- name: Upload installer
uses: actions/upload-artifact@v4
with:
path: build/${{ steps.build-installer.outputs.C2_INSTALLER_BASE_NAME }}.exe
name: ${{ steps.build-installer.outputs.C2_INSTALLER_BASE_NAME }}.exe
- name: Upload portable
uses: actions/upload-artifact@v4
with:
path: build/${{ steps.bundle-portable.outputs.C2_PORTABLE_BASE_NAME }}.zip
name: ${{ steps.bundle-portable.outputs.C2_PORTABLE_BASE_NAME }}.zip
- name: Create nightly release
if: ${{ contains(steps.build-installer.outputs.C2_INSTALLER_BASE_NAME, 'Nightly') && env.RELEASE_NIGHTLY_INSTALLER == 'ON' }}
uses: ncipollo/[email protected]
with:
replacesArtifacts: true
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
artifactErrorsFailBuild: true
artifacts: |
build/${{ steps.build-installer.outputs.C2_INSTALLER_BASE_NAME }}.exe
build/${{ steps.bundle-portable.outputs.C2_PORTABLE_BASE_NAME }}.zip
prerelease: true
name: Nightly Release
tag: nightly-build
check-release:
runs-on: ubuntu-latest
needs: create-installer
outputs:
IS_TAGGED: ${{ steps.is-rel.outputs.IS_TAGGED }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # allows for tags access
- name: Check Release
id: is-rel
run: |
set +e;
git describe --exact-match --match 'v*' &> /dev/null;
echo "IS_TAGGED=$?" >> "$GITHUB_OUTPUT";
shell: bash
draft-release:
runs-on: ubuntu-latest
needs: [create-installer, check-release]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # allows for tags access
- uses: actions/download-artifact@v4
with:
name: Chatterino7${{ needs.check-release.outputs.IS_TAGGED != '0' && '.Nightly' || '' }}.Installer.exe
path: build/
- uses: actions/download-artifact@v4
with:
name: Chatterino7${{ needs.check-release.outputs.IS_TAGGED != '0' && '.Nightly' || '' }}.Portable.zip
path: build/
- name: Download artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yml
name_is_regexp: true
name: '((^[Cc]hatterino)-[^wW].+$)|(^.+\.7z$)'
path: build/
- name: Fix Directories
working-directory: build
run: |
for file in */ ; do
mv "$file$(find "$file" -type f -printf '%f')" ".tmp.${file%/}";
rm -rf "$file";
mv ".tmp.${file%/}" "${file%/}";
done
shell: bash
- name: Fix paths
working-directory: build
run: |
ls -l
mv Chatterino-ubuntu-22.04-Qt-6.7.2.deb Chatterino-Ubuntu-22.04-Qt6.deb
mv Chatterino-ubuntu-24.04-Qt-6.7.2.deb Chatterino-Ubuntu-24.04-Qt6.deb
mv Chatterino-x86_64-Qt-6.7.2.AppImage Chatterino-x86_64-Qt6.AppImage
mv chatterino-windows-x86-64-Qt-6.7.3-symbols.pdb.7z Chatterino-Windows-debug-symbols.pdb.7z
mv chatterino-macos-Qt-6.7.1-universal.dmg Chatterino.dmg
- name: Hash files
working-directory: build
run: |
sha256sum * > sha256-checksums.txt
- name: Dry Run
if: ${{ needs.check-release.outputs.IS_TAGGED != '0' }}
run: |
echo "Dry Run"
echo "========================================"
echo "Files:"
ls -la build
echo "========================================"
echo "Sha256 sums:"
cat build/sha256-checksums.txt
- name: Get Tag
id: get-tag
if: ${{ needs.check-release.outputs.IS_TAGGED == '0' }}
run: echo "VALUE=$(git describe --exact-match --match 'v*')" >> "$GITHUB_OUTPUT"
- name: Create release
uses: ncipollo/[email protected]
if: ${{ needs.check-release.outputs.IS_TAGGED == '0' }}
with:
replacesArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
draft: true
artifacts: "build/*"
name: ${{ steps.get-tag.outputs.VALUE }}
tag: ${{ steps.get-tag.outputs.VALUE }}