From a5e1f4f0eff8450631de1be83fe966d88c0cffa6 Mon Sep 17 00:00:00 2001 From: YourKalamity <63474858+YourKalamity@users.noreply.github.com> Date: Fri, 18 Dec 2020 17:34:21 +0000 Subject: [PATCH] Add github workflow --- .github/workflows/executables.yml | 91 +++++++++++++++++++++++++++++++ .gitignore | 8 +++ .vscode/settings.json | 3 + 3 files changed, 102 insertions(+) create mode 100644 .github/workflows/executables.yml create mode 100644 .gitignore create mode 100644 .vscode/settings.json diff --git a/.github/workflows/executables.yml b/.github/workflows/executables.yml new file mode 100644 index 0000000..57ae164 --- /dev/null +++ b/.github/workflows/executables.yml @@ -0,0 +1,91 @@ +name: Compile into Executables + +on: + release: + types: [created] + +# +# Based off of : +# https://github.com/mondul/HiyaCFW-Helper/blob/master/.github/workflows/make-dist.yml +# Thanks to Epicpkmn11 for helping with this +# + +jobs: + windows: + runs-on: windows-latest + name: Windows + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + architecture: "x86" + - name: Install pyinstaller + run: | + pip3 install certifi pyinstaller + - name: Get tag + id: vars + shell: bash + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + - name: Make binary + run: | + 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 }}" ^ + main.py + cd dist + - name: Publish builds + uses: actions/upload-artifact@v2 + with: + path: lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}.exe + name: windows + + python: + runs-on: ubuntu-latest + name: Python 3 build + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Get tag + id: vars + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + - name: Make zip + run: | + mkdir temporary + cp -r certifi chardet Darwin idna Linux requests urllib3 temporary/ + cp LICENSE main.py README.md temporary/ + zip lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-Python3.zip temporary + - name: Publish artifact + uses: actions/upload-artifact@v2 + with: + path: lazy-dsi-file-downloader-${{ steps.vars.outputs.tag }}-Python3.zip + name: python + + publish: + runs-on: ubuntu-latest + name: Publish builds + if: ${{ success() }} + needs: [windows,python] + steps: + - name: Download artifacts + uses: actions/download-artifacts@v2 + - name: Upload to Release + run: | + ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH) + + for file in ${{ github.workspace }}/*/*; do + AUTH_HEADER="Authorization: token ${{ secrets.GITHUB_TOKEN }}" + CONTENT_LENGTH="Content-Length: $(stat -c%s $file)" + CONTENT_TYPE="Content-Type: application/octet-stream" + UPLOAD_URL="https://uploads.github.com/repos/${{ github.repository }}/releases/$ID/assets?name=$(basename $file)" + curl -XPOST -H "$AUTH_HEADER" -H "$CONTENT_LENGTH" -H "$CONTENT_TYPE" --upload-file "$file" "$UPLOAD_URL" + done + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc473d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.pyc +__pycache__/* +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5042d7f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "C:\\Program Files\\Python39\\python.exe" +} \ No newline at end of file