2024-03-08 23:13:53 +01:00
|
|
|
name: Executables
|
2021-02-16 02:47:30 +01:00
|
|
|
|
2024-03-03 18:10:55 +01:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2024-03-08 23:13:53 +01:00
|
|
|
tags-ignore:
|
|
|
|
- "*"
|
|
|
|
|
|
|
|
env:
|
|
|
|
DATE_FORMAT: "%Y.%m.%d"
|
2021-02-16 02:47:30 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
2024-07-04 23:44:52 +02:00
|
|
|
if: github.repository == 'mikf/gallery-dl'
|
2021-02-16 02:47:30 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
2024-05-28 21:40:51 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
2021-02-16 02:47:30 +01:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-04-18 20:45:48 +02:00
|
|
|
os: ["windows-latest", "macOS-latest"]
|
2021-12-09 23:34:03 +01:00
|
|
|
architecture: ["x64"]
|
2023-10-14 14:48:40 +02:00
|
|
|
python-version: ["3.12"]
|
2023-04-18 20:45:48 +02:00
|
|
|
python-packages: [""]
|
|
|
|
include:
|
|
|
|
- os: "ubuntu-latest"
|
|
|
|
architecture: "x64"
|
2023-10-14 14:48:40 +02:00
|
|
|
python-version: "3.12"
|
2023-04-18 20:45:48 +02:00
|
|
|
python-packages: "secretstorage"
|
2022-03-14 18:06:36 +01:00
|
|
|
- os: "windows-2019"
|
2021-12-09 23:34:03 +01:00
|
|
|
architecture: "x86"
|
2023-04-18 20:45:48 +02:00
|
|
|
python-version: "3.8"
|
|
|
|
python-packages: "toml"
|
2021-02-16 02:47:30 +01:00
|
|
|
|
|
|
|
steps:
|
2023-12-02 13:56:21 +01:00
|
|
|
- uses: actions/checkout@v4
|
2021-02-16 02:47:30 +01:00
|
|
|
|
2021-12-09 23:34:03 +01:00
|
|
|
- name: Set up Python ${{ matrix.python-version }} ${{ matrix.architecture }}
|
2024-03-08 23:13:53 +01:00
|
|
|
uses: actions/setup-python@v5
|
2021-02-16 02:47:30 +01:00
|
|
|
with:
|
2021-12-09 23:34:03 +01:00
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
architecture: ${{ matrix.architecture }}
|
2021-02-16 02:47:30 +01:00
|
|
|
|
2024-05-28 21:40:51 +02:00
|
|
|
- name: Environment Variables
|
2024-05-27 21:37:01 +02:00
|
|
|
run: |
|
|
|
|
echo "DATE=$(date '+${{ env.DATE_FORMAT }}')" >> "$GITHUB_ENV"
|
|
|
|
echo "LABEL=$(python ./scripts/pyinstaller.py --print --os '${{ matrix.os }}' --arch '${{ matrix.architecture }}')" >> "$GITHUB_ENV"
|
2024-03-08 23:13:53 +01:00
|
|
|
|
|
|
|
- name: Update Version
|
|
|
|
# use Python since its behavior is consistent across operating systems
|
|
|
|
shell: python
|
|
|
|
run: |
|
|
|
|
import re
|
2024-03-09 23:47:35 +01:00
|
|
|
path = "./gallery_dl/version.py"
|
2024-03-08 23:13:53 +01:00
|
|
|
with open(path) as fp:
|
|
|
|
content = fp.read()
|
|
|
|
content = re.sub(
|
|
|
|
r'\b(__version__ = "[^"]+)',
|
|
|
|
r"\1:${{ env.DATE }}",
|
|
|
|
content)
|
2024-05-27 21:37:01 +02:00
|
|
|
content = re.sub(
|
|
|
|
r'\b(__variant__ =).+',
|
|
|
|
r'\1 "dev/${{ env.LABEL }}"',
|
|
|
|
content)
|
2024-03-08 23:13:53 +01:00
|
|
|
with open(path, "w") as fp:
|
|
|
|
fp.write(content)
|
|
|
|
|
2021-02-16 02:47:30 +01:00
|
|
|
- name: Build executable
|
|
|
|
run: |
|
2024-10-17 09:20:26 +02:00
|
|
|
pip install requests requests[socks] yt-dlp[default] pyyaml ${{ matrix.python-packages }} pyinstaller
|
2024-05-29 02:46:29 +02:00
|
|
|
python ./scripts/pyinstaller.py --label '${{ env.LABEL }}'
|
2024-03-08 23:13:53 +01:00
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
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@v4
|
|
|
|
|
2024-05-28 21:40:51 +02:00
|
|
|
- name: Environment Variables
|
2024-03-08 23:13:53 +01:00
|
|
|
run: echo "DATE=$(date '+${{ env.DATE_FORMAT }}')" >> "$GITHUB_ENV"
|
2021-02-16 02:47:30 +01:00
|
|
|
|
2024-05-24 02:05:27 +02:00
|
|
|
- name: Body
|
|
|
|
run: printf 'https://github.com/%s/commit/%s' '${{ github.repository }}' '${{ github.sha }}' > body.md
|
|
|
|
|
2024-03-08 23:13:53 +01:00
|
|
|
- uses: ncipollo/release-action@v1
|
2021-02-16 02:47:30 +01:00
|
|
|
with:
|
2024-03-08 23:13:53 +01:00
|
|
|
owner: gdl-org
|
|
|
|
repo: builds
|
|
|
|
tag: ${{ env.DATE }}
|
2024-05-24 02:05:27 +02:00
|
|
|
bodyFile: body.md
|
2024-03-08 23:13:53 +01:00
|
|
|
artifacts: "executable-*/*"
|
|
|
|
allowUpdates: true
|
|
|
|
makeLatest: true
|
|
|
|
token: ${{ secrets.REPO_TOKEN }}
|