-
Notifications
You must be signed in to change notification settings - Fork 1
193 lines (162 loc) · 5.68 KB
/
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
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
189
190
191
192
193
name: Release Python app
run-name: Release ${{ github.ref_name }}
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build app on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["windows-latest", "macos-latest", "ubuntu-latest"]
steps:
- name: Checkout ref
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install requirements
run: |
pip install -r requirements.txt
pip install pyinstaller
- name: PyInstaller (Terminal GUI)
run: pyinstaller --onefile --icon=images/icon.ico versions/terminal_gui.py
- name: List dist directory
run: ls -R dist
- name: PyInstaller (CLI)
run: pyinstaller --onefile --icon=images/icon.ico versions/cli_args.py
- name: List dist directory
run: ls -R dist
- name: Rename artifacts on Mac & Linux first
if: ${{ matrix.os != 'windows-latest' }}
run: |
cd dist
mv terminal_gui ${{ matrix.os }}_${{ github.ref_name }}_cmdgui-release
mv cli_args ${{ matrix.os }}_${{ github.ref_name }}_cmdline-release
- name: Upload debug builds
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}_builds
path: build/
- name: Upload distributable builds
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}_dists
path: dist/
normal_release:
name: Draft normal release
runs-on: ubuntu-latest
needs: build
if: '!contains(github.ref_name, "_")'
steps:
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: windows-latest_dist
path: release-artifacts
- name: Download MacOS artifact
uses: actions/download-artifact@v4
with:
name: macos-latest_dist
path: release-artifacts
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: ubuntu-latest_dist
path: release-artifacts
- name: List release-artifacts directory # debug
run: ls -R release-artifacts
- name: Rename Windows artifacts
run: |
cd release-artifacts
mv terminal_window.exe windows-latest_${{ github.ref_name }}_cmdgui-release.exe
mv cli_args.exe windows-latest_${{ github.ref_name }}_cmdline-release.exe
- name: Draft normal release
uses: ncipollo/release-action@v1.14.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts: release-artifacts/*_${{ github.ref_name }}_*-release*
draft: true
name: "Release ${{ github.ref_name }}"
body: "If you're using the CLI, we recommend renaming the artifact to something shorter, like 'translator-CLI'."
release_cmdgui:
name: Draft CMDGUI release
runs-on: ubuntu-latest
needs: build
if: endsWith(github.ref_name, '_CMDGUI')
steps:
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: windows-latest_dists
path: release-artifacts
- name: Download MacOS artifact
uses: actions/download-artifact@v4
with:
name: macos-latest_dists
path: release-artifacts
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: ubuntu-latest_dists
path: release-artifacts
- name: List release-artifacts directory # debug
run: ls -R release-artifacts
- name: Rename Windows artifacts
run: |
cd release-artifacts
mv terminal_gui.exe windows-latest_${{ github.ref_name }}_cmdgui-release.exe
- name: Draft CMDGUI release
uses: ncipollo/release-action@v1.14.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts: release-artifacts/*_${{ github.ref_name }}_cmdgui-release*
draft: true
name: "CMDGUI Release ${{ github.ref_name }}"
body: "This is a CMDGUI-specific release."
release_cli:
name: Draft CLI release
runs-on: ubuntu-latest
needs: build
if: endsWith(github.ref_name, '_CLI')
steps:
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: windows-latest_dists
path: release-artifacts
- name: Download MacOS artifact
uses: actions/download-artifact@v4
with:
name: macos-latest_dists
path: release-artifacts
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: ubuntu-latest_dists
path: release-artifacts
- name: List release-artifacts directory # debug
run: ls -R release-artifacts
- name: Rename Windows artifacts
run: |
cd release-artifacts
mv cli_args.exe windows-latest_${{ github.ref_name }}_cmdline-release.exe
- name: Draft CLI release
uses: ncipollo/release-action@v1.14.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts: release-artifacts/*_${{ github.ref_name }}_cmdline-release*
draft: true
name: "CLI Release ${{ github.ref_name }}"
body: "This is a CLI-specific release. We recommend renaming the artifact to something shorter, like 'translator-CLI'."