-
Notifications
You must be signed in to change notification settings - Fork 2
139 lines (118 loc) · 3.76 KB
/
release-packaging.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
name: Create Release
on:
push:
branches-ignore:
- '**'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
jobs:
build-binaries:
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Setup Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.2.2
- name: Get tag
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install Linux dependencies
if: ${{ runner.os == 'Linux' }}
run: >
sudo apt-get install
'^libxcb.*-dev'
libx11-xcb-dev
libglu1-mesa-dev
libxrender-dev
libxi-dev
libxkbcommon-dev
libxkbcommon-x11-dev
- name: Install dependencies
run: |
poetry version ${{ env.tag }}
sed -i "s/0.0.0/${{ env.tag }}/g" gui/__init__.py
sed -i "s/0.0.0/${{ env.tag }}/g" glint_mask_generator/__init__.py
poetry run pip install --upgrade pip setuptools
poetry install
- name: Build Windows GUI Executable
if: ${{ runner.os == 'Windows' }}
run: >
poetry run pyinstaller
--onefile
--windowed
--icon='gui\resources\gmt.ico'
--add-data='gui\resources\gmt.ico;resources'
--add-data="gui\resources\*.ui;resources"
--hidden-import="gui.widgets.buffer_ctrl"
--hidden-import="gui.widgets.threshold_ctrl"
--hidden-import="gui.widgets.directory_path"
gui/__main__.py
- name: Build Linux GUI Executable
if: ${{ runner.os == 'Linux' }}
run: >
poetry run pyinstaller
--onefile
--icon='gui/resources/gmt.ico'
--add-data='gui/resources/gmt.ico:resources'
--add-data="gui/resources/*.ui:resources"
--hidden-import="gui.widgets.buffer_ctrl"
--hidden-import="gui.widgets.threshold_ctrl"
--hidden-import="gui.widgets.directory_path"
gui/__main__.py
- name: Archive release artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-dist
path: dist
create-release:
needs: build-binaries
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get tag
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Detect prerelease
id: prerelease
run: |
if echo ${{ env.tag }} | grep -qe '?*.*.*rc*'; then
echo "prerelease=true" >> $GITHUB_ENV
else
echo "prerelease=false" >> $GITHUB_ENV
fi
- name: Download Windows artifacts
uses: actions/download-artifact@v3
with:
name: windows-latest-dist
path: win64-dist
- name: Download Ubuntu artifacts
uses: actions/download-artifact@v3
with:
name: ubuntu-latest-dist
path: linux-dist
- name: Rename release artifacts
run: |
mv win64-dist/__main__.exe GlintMaskGenerator-v${{ env.tag }}-win64.exe
mv linux-dist/__main__ GlintMaskGenerator-v${{ env.tag }}-linux
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: v${{ env.tag }}
prerelease: ${{ env.prerelease }}
draft: true
files: |
GlintMaskGenerator-v${{ env.tag }}-win64.exe
GlintMaskGenerator-v${{ env.tag }}-linux