Skip to content

Commit 964b729

Browse files
authored
Merge pull request #19 from lifehackerhansol/cxfreeze
Switch Windows builds to cx_Freeze
2 parents 2b07c25 + dc24a49 commit 964b729

File tree

2 files changed

+47
-26
lines changed

2 files changed

+47
-26
lines changed

Diff for: .github/workflows/executables.yml

+29-26
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,34 @@ jobs:
1717
name: Windows
1818
steps:
1919
- name: Checkout Repo
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
2121
- name: Setup Python
22-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v3
2323
with:
2424
python-version: "3.8.x"
25-
- name: Install pyinstaller
26-
run: |
27-
pip3 install certifi pyinstaller
25+
- name: Install cx_Freeze
26+
run: py -m pip install cx_Freeze
2827
- name: Get tag
2928
id: vars
3029
shell: bash
3130
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
3231
- name: Make binary
3332
run: |
34-
pyinstaller --onefile --add-data "certifi;certifi" --add-data "requests;requests" --add-data "urllib3;urllib3" --add-data "lazy.ico;." --add-data "chardet;chardet" --icon "lazy.ico" --console --name "lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-Windows" main.py
35-
cd dist
33+
py cxfreeze_setup.py build
34+
mv dist/main.exe dist/lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-Windows.exe
35+
shell: bash
3636
- name: Publish builds
37-
uses: actions/upload-artifact@v2
37+
uses: actions/upload-artifact@v3
3838
with:
39-
path: dist/lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-Windows.exe
39+
path: dist
4040
name: windows
4141

4242
python:
4343
runs-on: ubuntu-latest
4444
name: Python 3 build
4545
steps:
4646
- name: Checkout repo
47-
uses: actions/checkout@v2
47+
uses: actions/checkout@v3
4848
- name: Get tag
4949
id: vars
5050
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
@@ -57,7 +57,7 @@ jobs:
5757
chmod +x main.py
5858
zip -r ../lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-Python3.zip *
5959
- name: Publish artifact
60-
uses: actions/upload-artifact@v2
60+
uses: actions/upload-artifact@v3
6161
with:
6262
path: lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-Python3.zip
6363
name: python
@@ -68,9 +68,9 @@ jobs:
6868
name: macOS
6969
steps:
7070
- name: Checkout Repo
71-
uses: actions/checkout@v2
71+
uses: actions/checkout@v3
7272
- name: Setup Python
73-
uses: actions/setup-python@v2
73+
uses: actions/setup-python@v3
7474
with:
7575
python-version: "3.x"
7676
- name: Install pyinstaller
@@ -86,7 +86,7 @@ jobs:
8686
chmod +x lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-macOS
8787
zip ../lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-macOS.zip lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-macOS
8888
- name: Publish artifact
89-
uses: actions/upload-artifact@v2
89+
uses: actions/upload-artifact@v3
9090
with:
9191
path: lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-macOS.zip
9292
name: macos
@@ -98,16 +98,19 @@ jobs:
9898
needs: [windows,python,macos]
9999
steps:
100100
- name: Download artifacts
101-
uses: actions/download-artifact@v2
102-
- name: Upload to Release
101+
uses: actions/download-artifact@v3
102+
- name: Get tag
103+
id: vars
104+
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
105+
- name: re-zip Windows
103106
run: |
104-
ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)
105-
106-
for file in ${{ github.workspace }}/*/*; do
107-
AUTH_HEADER="Authorization: token ${{ secrets.GITHUB_TOKEN }}"
108-
CONTENT_LENGTH="Content-Length: $(stat -c%s $file)"
109-
CONTENT_TYPE="Content-Type: application/octet-stream"
110-
UPLOAD_URL="https://uploads.github.com/repos/${{ github.repository }}/releases/$ID/assets?name=$(basename $file)"
111-
curl -XPOST -H "$AUTH_HEADER" -H "$CONTENT_LENGTH" -H "$CONTENT_TYPE" --upload-file "$file" "$UPLOAD_URL"
112-
done
113-
107+
cd windows
108+
zip -r lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-Windows.zip *
109+
cd ..
110+
- name: Release
111+
uses: softprops/action-gh-release@v1
112+
with:
113+
files: |
114+
windows/lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-Windows.zip
115+
macos/lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-macOS.zip
116+
python/lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-Python3.zip

Diff for: cxfreeze_setup.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env python3
2+
3+
from cx_Freeze import setup, Executable
4+
5+
# Dependencies are automatically detected, but it might need fine tuning.
6+
# "packages": ["os"] is used as example only
7+
build_exe_options = {'build_exe': "dist"}
8+
9+
# base="Win32GUI" should be used only for Windows GUI app
10+
base = "Win32GUI"
11+
12+
setup(
13+
name="lazy-dsi-file-downloader",
14+
version="3.1.3",
15+
description="Lazy DSi File Downloader",
16+
options={"build_exe": build_exe_options},
17+
executables=[Executable("main.py", base=base)],
18+
)

0 commit comments

Comments
 (0)