Skip to content

Updates:

Updates: #44

Workflow file for this run

name: Build and Release Python Executable
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout repository
run: |
git clone https://github.com/RetroCyber/thcrap_patch_mirror.git
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
cd thcrap_patch_mirror
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build executables
run: |
cd thcrap_patch_mirror
pyinstaller --onefile add_patch.py
pyinstaller --onefile mirror_repo.py
- name: Package executables on Windows
if: runner.os == 'Windows'
run: |
mkdir -p dist/win
Move-Item -Path 'dist/add_patch.exe', 'dist/mirror_repo.exe' -Destination 'dist/win/'
shell: pwsh
working-directory: thcrap_patch_mirror
- name: Package executables on Linux
if: runner.os == 'Linux'
run: |
mkdir -p dist/linux
mv dist/add_patch dist/mirror_repo dist/linux/
shell: bash
working-directory: thcrap_patch_mirror
- name: Package executables on macOS
if: runner.os == 'macOS'
run: |
mkdir -p dist/macos
mv dist/add_patch dist/mirror_repo dist/macos/
shell: bash
working-directory: thcrap_patch_mirror
- name: Set Platform Name
id: set_platform_name
run: |
PLATFORM_NAME="${{ matrix.os }}"
if [[ "${PLATFORM_NAME}" == "ubuntu-latest" ]]; then
PLATFORM_NAME="linux"
elif [[ "${PLATFORM_NAME}" == "windows-latest" ]]; then
PLATFORM_NAME="win"
elif [[ "${PLATFORM_NAME}" == "macos-latest" ]]; then
PLATFORM_NAME="macos"
fi
echo "PLATFORM_NAME=${PLATFORM_NAME}" >> $GITHUB_ENV
shell: bash
- name: Upload Package
uses: actions/upload-artifact@v4
with:
name: thpatch_mirror-${{ env.PLATFORM_NAME }}
path: |
thcrap_patch_mirror/dist/win/*
thcrap_patch_mirror/dist/linux/*
thcrap_patch_mirror/dist/macos/*
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Install zip and tar
run: |
sudo apt-get update
sudo apt-get install -y zip tar
- name: Package the mirror script
run: |
cd ./dist
cd ./thpatch_mirror-win/win
zip -r ../../thpatch_mirror_win.zip ./*
cd ../../
cd ./thpatch_mirror-linux/linux
tar -czvf ../../thpatch_mirror_linux.tar.gz ./*
cd ../../
cd ./thpatch_mirror-macos/macos
tar -czvf ../../thpatch_mirror_mac.tar.gz ./*
cd ../../
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Extract Release Notes
id: extract_release_notes
run: |
python generate_release_note.py
- name: Create Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ./release_note.md
files: |
./dist/thpatch_mirror_win.zip
./dist/thpatch_mirror_linux.tar.gz
./dist/thpatch_mirror_mac.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}