-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (122 loc) · 4.59 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
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 ${{ matrix.os }}_${{ github.ref_name }}_cmd-release
- name: List dist directory # debug
run: ls -R dist
- name: PyInstaller (CLI)
run: pyinstaller --onefile --icon=images/icon.ico versions/cli_args.py --name ${{ matrix.os }}_${{ github.ref_name }}_cli-release
- name: List dist directory
run: ls -R dist
- name: Tar files on Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
chmod +x dist/${{ matrix.os }}_${{ github.ref_name }}_cmd-release
chmod +x dist/${{ matrix.os }}_${{ github.ref_name }}_cli-release
tar -czvf dist/${{ matrix.os }}_${{ github.ref_name }}_cmd.tar.gz dist/${{ matrix.os }}_${{ github.ref_name }}_cmd-release
tar -czvf dist/${{ matrix.os }}_${{ github.ref_name }}_cli.tar.gz dist/${{ matrix.os }}_${{ github.ref_name }}_cli-release
rm -rf dist/${{ matrix.os }}_${{ github.ref_name }}_cmd-release
rm -rf dist/${{ matrix.os }}_${{ github.ref_name }}_cli-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 artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
pattern: "*_dists"
- name: List release-artifacts directory # debug
run: ls -R release-artifacts
- name: Draft normal release
uses: ncipollo/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts: release-artifacts/*_dists/*_${{ github.ref_name }}_*
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 artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
pattern: "*_dists"
- name: List release-artifacts directory # debug
run: ls -R release-artifacts
- name: Draft CMDGUI release
uses: ncipollo/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts: release-artifacts/*_dists/*_${{ github.ref_name }}_cmd*
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 artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
pattern: "*_dists"
- name: List release-artifacts directory # debug
run: ls -R release-artifacts
- name: Draft CLI release
uses: ncipollo/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts: release-artifacts/*_dists/*_${{ github.ref_name }}_cli*
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'."