Workflow file for this run
This file contains 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: Build into Executables And Release | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
buildDesktop: | |
runs-on: ${{ matrix.os }} | |
env: | |
working-directory: ./src/python/ | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
cache: 'pip' | |
- run: pip install -r requirements.txt | |
- name: Build with PyInstaller | |
working-directory: ${{env.working-directory}} | |
run: pyinstaller --clean main.spec --distpath ./ | |
- name: List Dir if MacOS or Linux | |
if: matrix.os != 'windows-latest' | |
working-directory: ${{env.working-directory}} | |
run: ls | |
- name: List Dir if Windows | |
if: matrix.os == 'windows-latest' | |
working-directory: ${{env.working-directory}} | |
run: dir | |
- name: Create release artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Genshin-Stopwatch-Assets-${{ matrix.os }} | |
path: | | |
${{env.working-directory}}Genshin* | |
release-asset: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
needs: buildDesktop | |
permissions: | |
contents: write | |
steps: | |
- name: Define Ubuntu Extension Var | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
echo "AssetPath=Genshin-Stopwatch-Assets-ubuntu-latest" >> "$GITHUB_ENV" | |
echo "genshin_exe=GenshinStopwatch" >> "$GITHUB_ENV" | |
echo "zipname=Ubuntu" >> "$GITHUB_ENV" | |
- name: Define Windows Extension Var | |
if: matrix.os == 'windows-latest' | |
run: | | |
echo "AssetPath=Genshin-Stopwatch-Assets-windows-latest" >> "$GITHUB_ENV" | |
echo "genshin_exe=GenshinStopwatch.exe" >> "$GITHUB_ENV" | |
echo "zipname=Windows" >> "$GITHUB_ENV" | |
- name: Define MacOS Extension Var | |
if: matrix.os == 'macos-latest' | |
run: | | |
echo "AssetPath=Genshin-Stopwatch-Assets-macos-latest" >> "$GITHUB_ENV" | |
echo "genshin_exe=GenshinStopwatch" >> "$GITHUB_ENV" | |
echo "zipname=MacOS" >> "$GITHUB_ENV" | |
- name: Create Directory | |
run: mkdir -p "Genshin-Stopwatch-${{ matrix.os }}" | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: "Genshin-Stopwatch-Assets-${{ matrix.os }}" | |
path: "Genshin-Stopwatch-${{ matrix.os }}" | |
- name: List Dir | |
run: | | |
cd ${{ github.workspace }} | |
echo "This is Main Dir" | |
ls | |
echo "This is within the program dir, where the artifact's contents are" | |
ls "Genshin-Stopwatch-${{ matrix.os }}" | |
- name: Zipping directory | |
uses: montudor/action-zip@v1 | |
with: | |
args: zip -qq -r "Genshin-Stopwatch-${{ env.zipname }}.zip" "Genshin-Stopwatch-${{ matrix.os }}" | |
- name: Upload Artifact to Release Assets | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: Genshin-Stopwatch-${{ env.zipname }}.zip |