Executables #1180
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Executables | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| env: | |
| DATE_FORMAT: "%Y.%m.%d" | |
| jobs: | |
| build: | |
| if: github.repository == 'mikf/gallery-dl' | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| outputs: | |
| SHA: ${{ steps.out.outputs.SHA }} | |
| MSG: ${{ steps.out.outputs.MSG }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["windows-latest", "macOS-latest"] | |
| architecture: ["x64"] | |
| python-version: ["3.14"] | |
| python-packages: [""] | |
| include: | |
| - os: "ubuntu-latest" | |
| architecture: "x64" | |
| python-version: "3.14" | |
| python-packages: "secretstorage" | |
| - os: "windows-2022" | |
| architecture: "x86" | |
| python-version: "3.8" | |
| python-packages: "toml" | |
| steps: | |
| - name: Clone repo | |
| run: | | |
| git clone --depth 1 --no-tags https://codeberg.org/mikf/gallery-dl.git . | |
| - name: Set up Python ${{ matrix.python-version }} ${{ matrix.architecture }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: ${{ matrix.architecture }} | |
| - name: Output Values | |
| id: out | |
| run: | | |
| echo "SHA=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
| echo "MSG<<EOF" >> "$GITHUB_OUTPUT" | |
| printf '%s\n' "$(git show -s --format=%s HEAD)" >> "$GITHUB_OUTPUT" | |
| echo "EOF" >> "$GITHUB_OUTPUT" | |
| - name: Environment Variables | |
| run: | | |
| echo "DATE=$(date '+${{ env.DATE_FORMAT }}')" >> "$GITHUB_ENV" | |
| echo "LABEL=$(python ./scripts/pyinstaller.py --print --os '${{ matrix.os }}' --arch '${{ matrix.architecture }}')" >> "$GITHUB_ENV" | |
| - name: Update Version | |
| # use Python since its behavior is consistent across operating systems | |
| shell: python | |
| run: | | |
| import re | |
| path = "./gallery_dl/version.py" | |
| with open(path) as fp: | |
| content = fp.read() | |
| content = re.sub( | |
| r'\b(__version__ = "[^"]+)', | |
| r"\1:${{ env.DATE }}", | |
| content) | |
| content = re.sub( | |
| r'\b(__variant__ =).+', | |
| r'\1 "dev/${{ env.LABEL }}"', | |
| content) | |
| with open(path, "w") as fp: | |
| fp.write(content) | |
| - name: Build executable | |
| run: | | |
| pip install requests requests[socks] yt-dlp[default] pyyaml ${{ matrix.python-packages }} pyinstaller | |
| pip install truststore || true | |
| python ./scripts/pyinstaller.py --label '${{ env.LABEL }}' | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: executable-${{ matrix.os }}-${{ matrix.architecture }}-${{ matrix.python-version }} | |
| path: dist/* | |
| retention-days: 1 | |
| compression-level: 0 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| - name: Environment Variables | |
| run: echo "DATE=$(date '+${{ env.DATE_FORMAT }}')" >> "$GITHUB_ENV" | |
| - name: Body | |
| env: | |
| SHA: ${{ needs.build.outputs.SHA }} | |
| MSG: ${{ needs.build.outputs.MSG }} | |
| run: | | |
| printf '[`%s`](https://codeberg.org/mikf/gallery-dl/commit/%s) %s' "${SHA::8}" "$SHA" "$MSG" > body.md | |
| - uses: ncipollo/release-action@v1 | |
| with: | |
| owner: gdl-org | |
| repo: builds | |
| tag: ${{ env.DATE }} | |
| bodyFile: body.md | |
| artifacts: "executable-*/*" | |
| allowUpdates: true | |
| makeLatest: true | |
| token: ${{ secrets.REPO_TOKEN }} |