Skip to content

Commit f199bb6

Browse files
Update release-binaries.yml
1 parent c9ef5ec commit f199bb6

1 file changed

Lines changed: 34 additions & 68 deletions

File tree

.github/workflows/release-binaries.yml

Lines changed: 34 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ concurrency:
1212

1313
jobs:
1414
tag:
15-
name: Extract version & create tag
1615
runs-on: ubuntu-latest
1716
permissions:
1817
contents: write
@@ -30,52 +29,54 @@ jobs:
3029
run: |
3130
VERSION=$(python3 - <<'EOF'
3231
import tomllib
33-
with open("pyproject.toml", "rb") as f:
32+
with open("pyproject.toml","rb") as f:
3433
print(tomllib.load(f)["project"]["version"])
3534
EOF
3635
)
37-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
38-
echo "tag=$VERSION" >> "$GITHUB_OUTPUT"
36+
echo "version=$VERSION" >> $GITHUB_OUTPUT
37+
echo "tag=$VERSION" >> $GITHUB_OUTPUT
3938
4039
- id: check
4140
run: |
4241
if git rev-parse "refs/tags/${{ steps.extract.outputs.tag }}" >/dev/null 2>&1; then
43-
echo "exists=true" >> "$GITHUB_OUTPUT"
42+
echo "exists=true" >> $GITHUB_OUTPUT
4443
else
45-
echo "exists=false" >> "$GITHUB_OUTPUT"
44+
echo "exists=false" >> $GITHUB_OUTPUT
4645
fi
4746
4847
- if: steps.check.outputs.exists == 'false'
4948
run: |
50-
git config user.name "github-actions[bot]"
51-
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
git config user.name github-actions[bot]
50+
git config user.email github-actions[bot]@users.noreply.github.com
5251
git tag "${{ steps.extract.outputs.tag }}"
5352
git push origin "${{ steps.extract.outputs.tag }}"
5453
5554
build-linux:
56-
name: Build (linux)
5755
needs: tag
5856
runs-on: ubuntu-latest
5957

6058
steps:
6159
- uses: actions/checkout@v4
6260

63-
- name: Build inside manylinux2014 (glibc 2.17)
61+
- name: Build Linux (manylinux2014)
6462
env:
6563
VERSION: ${{ needs.tag.outputs.version }}
6664
run: |
67-
printf 'from bangen.app import main\nif __name__ == "__main__":\n main()\n' > _entry.py
65+
printf 'from bangen.app import main\nif __name__=="__main__": main()\n' > _entry.py
6866
6967
docker run --rm \
7068
-u $(id -u):$(id -g) \
69+
-e HOME=/tmp \
70+
-e PIP_NO_CACHE_DIR=1 \
7171
-v "${{ github.workspace }}:/workspace" \
7272
-w /workspace \
73-
-e VERSION="$VERSION" \
7473
ghcr.io/yt-dlp/manylinux2014_x86_64-shared \
7574
bash -c '
7675
set -euo pipefail
77-
py3.13 -m pip install -q -U pip wheel pyinstaller
78-
py3.13 -m pip install -q ".[all]"
76+
77+
py3.13 -m pip install -U pip wheel pyinstaller --no-cache-dir
78+
py3.13 -m pip install ".[all]" --no-cache-dir
79+
7980
py3.13 -m PyInstaller \
8081
--onefile \
8182
--noconfirm \
@@ -103,25 +104,22 @@ jobs:
103104
--optimize 2 \
104105
_entry.py
105106
106-
echo "=== GLIBC symbols ==="
107-
strings dist/bangen | grep "GLIBC_" | sort -V | uniq
107+
echo "=== GLIBC CHECK ==="
108+
strings dist/bangen | grep GLIBC_ | sort -V | uniq
108109
109110
if strings dist/bangen | grep -E "GLIBC_2\.(1[89]|[2-9][0-9])"; then
110-
echo "ERROR: Binary requires glibc newer than 2.17!"
111+
echo "ERROR: requires newer glibc"
111112
exit 1
112113
fi
113114
114115
echo "✅ glibc 2.17 compatible"
115116
'
116117
117-
- name: Package artifact
118-
env:
119-
VERSION: ${{ needs.tag.outputs.version }}
120-
run: |
118+
- run: |
121119
mkdir -p release
122-
NAME="bangen-linux-$VERSION"
123-
mv dist/bangen release/"$NAME"
124-
(cd release && tar -czf "$NAME.tar.gz" "$NAME" && rm "$NAME")
120+
NAME="bangen-linux-${{ needs.tag.outputs.version }}"
121+
mv dist/bangen release/$NAME
122+
cd release && tar -czf "$NAME.tar.gz" "$NAME" && rm "$NAME"
125123
126124
- uses: actions/upload-artifact@v4
127125
with:
@@ -130,20 +128,18 @@ jobs:
130128
retention-days: 1
131129

132130
build-windows-macos:
133-
name: Build (${{ matrix.name }})
134131
needs: tag
135132
runs-on: ${{ matrix.os }}
136133

137134
strategy:
138-
fail-fast: false
139135
matrix:
140136
include:
141137
- os: windows-latest
142138
name: windows
143-
binary: bangen.exe
139+
bin: bangen.exe
144140
- os: macos-latest
145141
name: macos
146-
binary: bangen
142+
bin: bangen
147143

148144
steps:
149145
- uses: actions/checkout@v4
@@ -152,62 +148,33 @@ jobs:
152148
with:
153149
python-version: "3.11"
154150

155-
- uses: actions/cache@v4
156-
with:
157-
path: |
158-
~/.cache/pip
159-
~/AppData/Local/pip/Cache
160-
key: pip-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
161-
restore-keys: pip-${{ runner.os }}-
162-
163151
- run: |
164152
python -m pip install -U pip wheel pyinstaller
165153
pip install ".[all]"
166154
167-
- env:
168-
VERSION: ${{ needs.tag.outputs.version }}
169-
run: |
170-
printf 'from bangen.app import main\nif __name__ == "__main__":\n main()\n' > _entry.py
155+
- run: |
156+
printf 'from bangen.app import main\nif __name__=="__main__": main()\n' > _entry.py
171157
python -m PyInstaller \
172158
--onefile \
173159
--noconfirm \
174160
--noupx \
175161
--name bangen \
176162
--distpath dist \
177163
--workpath build \
178-
--collect-all bangen \
179-
--collect-all pyfiglet \
180-
--collect-all rich \
181-
--collect-all PIL \
182-
--collect-all typer \
183-
--exclude-module tkinter \
184-
--exclude-module unittest \
185-
--exclude-module test \
186-
--exclude-module distutils \
187-
--exclude-module setuptools \
188-
--exclude-module pkg_resources \
189-
--exclude-module email \
190-
--exclude-module http \
191-
--exclude-module html \
192-
--exclude-module xml \
193-
--exclude-module xmlrpc \
194164
--optimize 2 \
195165
_entry.py
196166
197-
- name: Package artifact
198-
env:
199-
VERSION: ${{ needs.tag.outputs.version }}
200-
BINARY: ${{ matrix.binary }}
201-
run: |
167+
- run: |
202168
mkdir -p release
203-
NAME="bangen-${{ matrix.name }}-$VERSION"
169+
NAME="bangen-${{ matrix.name }}-${{ needs.tag.outputs.version }}"
170+
204171
if [[ "$RUNNER_OS" == "Windows" ]]; then
205-
mv "dist/$BINARY" "release/$NAME.exe"
172+
mv dist/${{ matrix.bin }} release/$NAME.exe
206173
powershell -Command "Compress-Archive -Path release\\$NAME.exe -DestinationPath release\\$NAME.zip"
207-
rm "release/$NAME.exe"
174+
rm release/$NAME.exe
208175
else
209-
mv "dist/$BINARY" "release/$NAME"
210-
(cd release && tar -czf "$NAME.tar.gz" "$NAME" && rm "$NAME")
176+
mv dist/${{ matrix.bin }} release/$NAME
177+
cd release && tar -czf "$NAME.tar.gz" "$NAME" && rm "$NAME"
211178
fi
212179
213180
- uses: actions/upload-artifact@v4
@@ -217,7 +184,6 @@ jobs:
217184
retention-days: 1
218185

219186
release:
220-
name: Publish Release
221187
needs: [tag, build-linux, build-windows-macos]
222188
if: needs.tag.outputs.exists == 'false'
223189
runs-on: ubuntu-latest
@@ -237,5 +203,5 @@ jobs:
237203
- uses: softprops/action-gh-release@v2
238204
with:
239205
tag_name: ${{ needs.tag.outputs.tag }}
240-
name: "Bangen ${{ needs.tag.outputs.version }}"
206+
name: "Bangen ${{ needs.tag.outputs.version }}"
241207
files: artifacts/*

0 commit comments

Comments
 (0)