-
Notifications
You must be signed in to change notification settings - Fork 5
133 lines (115 loc) · 4.42 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
name: GWARipper release
on:
push:
# pattern matched against refs/tags
tags:
- 'v*'
jobs:
build_win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Get date
run: echo "date_year=$(date +'%Y')" >> "$GITHUB_ENV"
- name: Cache binary deps
id: cache-binary-deps
uses: actions/cache@v3
with:
path: binary_deps/
key: ${{ runner.os }}-build-${{ env.date_year }}
restore-keys: |
${{ runner.os }}-build-${{ env.date_year }}
${{ runner.os }}-build-
${{ runner.os }}-
# only download deps if we don't have a cached version
- if: ${{ steps.cache-binary-deps.outputs.cache-hit != 'true' }}
name: Download binary deps
run: |
mkdir binary_deps
Invoke-WebRequest https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip -OutFile ffmpeg.zip
Expand-Archive -Path ffmpeg.zip -DestinationPath .\binary_deps
Get-ChildItem -r -Filter ffmpeg.exe ./binary_deps/ | % { Copy-Item -Path $_.FullName -Destination ./binary_deps/ }
Remove-Item -Recurse -Force binary_deps/ffmpeg*-essentials_build/
Remove-Item ffmpeg.zip
- uses: actions/setup-python@v4
with:
python-version: '3.10'
# output (dir named 'gwaripper') will be in dist/windows
- name: Build PyInstaller single folder dist
run: |
python -m pip install -r requirements.txt
python -m pip install --upgrade pip pyinstaller
pyinstaller --clean -y --dist ./dist/windows/ --workpath /tmp gwaripper.spec
- name: Bundle folder dist
run: |
Push-Location dist/windows/gwaripper
Compress-Archive -Path * -DestinationPath ../../GWARipper-${{github.ref_name}}_single-folder_win-x64.zip
Pop-Location
- name: Updload windows build
uses: actions/upload-artifact@v3
with:
name: gwaripper-bundle-windows
path: dist/GWARipper-${{github.ref_name}}_single-folder_win-x64.zip
build_lin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# # only download deps if we don't have a cached version
# - if: ${{ steps.cache-binary-deps.outputs.cache-hit != 'true' }}
# name: Download binary deps Windows
# run: |
# mkdir binary_deps
# wget -O ffmpeg.zip https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip
# unzip ffmpeg.zip -d binary_deps/
# find binary_deps/ffmpeg*-essentials_build/ -name ffmpeg.exe -exec cp {} binary_deps/ \;
# rm -rf binary_deps/ffmpeg*-essentials_build/
# rm ffmpeg.zip
- uses: actions/setup-python@v4
with:
python-version: '3.10'
# output (dir named 'gwaripper') will be in dist/windows
- name: Build PyInstaller single folder dist
run: |
python -m pip install --upgrade pip pyinstaller
python -m pip install -r requirements.txt
pyinstaller --clean -y --dist ./dist/linux/ --workpath /tmp gwaripper.spec
- name: Bundle folder dist
run: |
pushd dist/linux/gwaripper
zip -r ../../GWARipper-${{github.ref_name}}_single-folder_lin-x64.zip .
popd
- name: Upload linux build
uses: actions/upload-artifact@v3
with:
name: gwaripper-bundle-linux
path: dist/GWARipper-${{github.ref_name}}_single-folder_lin-x64.zip
release:
runs-on: ubuntu-latest
needs: [build_win, build_lin]
steps:
- uses: actions/checkout@v4
- name: Package Source
run: |
mkdir dist/
python3 dev_tools/build_zip_dist.py . dist/GWARipper-${{github.ref_name}}.zip
# NOTE: downloads all artifacts in a workflow if with:name omitted
# then all artifact contents will be saved under a folder with their name
# so here:
# ./dist
# ./gwaripper-bundle-linux
# ./GWARipper-..._lin-x64.zip
# ./gwaripper-bundle-windows
# ./GWARipper-..._win-x64.zip
- name: Download builds
uses: actions/download-artifact@v3
with:
path: dist/
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: true
files: |
dist/GWARipper-${{github.ref_name}}.zip
dist/gwaripper-bundle-windows/GWARipper-${{github.ref_name}}_single-folder_win-x64.zip
dist/gwaripper-bundle-linux/GWARipper-${{github.ref_name}}_single-folder_lin-x64.zip