-
Notifications
You must be signed in to change notification settings - Fork 0
176 lines (170 loc) · 5.35 KB
/
build-release.yml
File metadata and controls
176 lines (170 loc) · 5.35 KB
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
name: Build release artefacts
run-name: Build release artefacts
on:
release:
types: [published]
jobs:
create-archive:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create archive
run: |
set -x
APP_VERSION=$GITHUB_SHA
if [ "$GITHUB_REF_TYPE" = "tag" ] ; then
APP_VERSION=`echo $GITHUB_REF_NAME | cut -dv -f2-`
fi
git archive --format=tar.gz --prefix=neknihy-$APP_VERSION/ HEAD >neknihy-$APP_VERSION.tar.gz
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_ENV"
- name: Upload tar archive
uses: actions/upload-artifact@v4
with:
name: tar
path: neknihy-*.tar.gz
retention-days: 5
build-rpm:
runs-on: ubuntu-latest
container: fedora:latest
needs: create-archive
steps:
- name: Download tar
uses: actions/download-artifact@v4
with:
name: tar
- name: Install dependencies
run: |
dnf -y install rpm-build python3-devel git
- name: Build rpm
run: |
set -x
APP_VERSION=$GITHUB_SHA
if [ "$GITHUB_REF_TYPE" = "tag" ] ; then
APP_VERSION=`echo $GITHUB_REF_NAME | cut -dv -f2-`
fi
echo $APP_VERSION
rpmbuild -D "SRCVERSION $APP_VERSION" -D "_rpmdir $(pwd)/rpm" -ta neknihy-*.tar.gz
mv rpm/noarch/*.rpm ./
- name: Upload rpm
uses: actions/upload-artifact@v4
with:
name: rpm
path: neknihy-*.rpm
retention-days: 5
build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Executable
uses: sayyid5416/pyinstaller@v1.3.0
with:
spec: 'src/neknihy.py'
requirements: 'src/REQUIREMENTS.txt'
options: --add-data src/resources:resources --icon src/resources/neknihy.ico -w
upload_exe_with_name: 'exe'
build-macos:
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Executable
uses: sayyid5416/pyinstaller@v1.3.0
with:
spec: 'src/neknihy.py'
requirements: 'src/REQUIREMENTS.txt'
options: --add-data src/resources:resources --icon src/resources/neknihy.icns -w --target-architecture x86_64
upload_exe_with_name: 'macos'
repack-zip:
runs-on: ubuntu-latest
needs: [build-windows, build-macos]
steps:
- name: Install packages
run: |
sudo apt-get install --yes zip
- name: Download exe
uses: actions/download-artifact@v4
with:
name: exe
path: windows
- name: Download macos
uses: actions/download-artifact@v4
with:
name: macos
path: macos
- name: Make zip
run: |
APP_VERSION=$GITHUB_SHA
if [ "$GITHUB_REF_TYPE" = "tag" ] ; then
APP_VERSION=`echo $GITHUB_REF_NAME | cut -dv -f2-`
fi
pushd windows/neknihy
zip -r ../../neknihy-win-$APP_VERSION.zip *
popd
pushd macos
zip -r ../neknihy-macos-$APP_VERSION.zip *
popd
- name: Upload win-zip archive
uses: actions/upload-artifact@v4
with:
name: win-zip
path: neknihy-win-*.zip
retention-days: 5
- name: Upload macos-zip archive
uses: actions/upload-artifact@v4
with:
name: macos-zip
path: neknihy-macos-*.zip
retention-days: 5
release-articacts:
permissions: write-all
runs-on: ubuntu-latest
needs: [create-archive, build-rpm, repack-zip]
steps:
- name: Download tar
uses: actions/download-artifact@v4
with:
name: tar
- name: Download rpm
uses: actions/download-artifact@v4
with:
name: rpm
- name: Download windows zip
uses: actions/download-artifact@v4
with:
name: win-zip
- name: Download macos zip
uses: actions/download-artifact@v4
with:
name: macos-zip
- name: Detect exact file names
run: |
echo "APP_TAR=`ls neknihy*.tar.gz`" >> "$GITHUB_ENV"
echo "APP_RPM=`ls neknihy*.rpm`" >> "$GITHUB_ENV"
echo "APP_WIN_ZIP=`ls neknihy-win*.zip`" >> "$GITHUB_ENV"
echo "APP_MACOS_ZIP=`ls neknihy-macos*.zip`" >> "$GITHUB_ENV"
- name: Upload rpm to release
uses: JasonEtco/upload-to-release@master
with:
args: ${{ env.APP_RPM }} application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload tar to release
uses: JasonEtco/upload-to-release@master
with:
args: ${{ env.APP_TAR }} application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload windows zip to release
uses: JasonEtco/upload-to-release@master
with:
args: ${{ env.APP_WIN_ZIP }} application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload macos zip to release
uses: JasonEtco/upload-to-release@master
with:
args: ${{ env.APP_MACOS_ZIP }} application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}