fix(artifacts workflow): fixed regression on how to zip on win runner #8
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 and Release Money4Band | |
on: | |
push: | |
tags: | |
- "*.*.*" # Matches tags like 1.0.0, 2.1.1, etc. | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] # Build for Linux, macOS, and Windows | |
architecture: [x64, arm64, armv7] # Target architectures | |
exclude: | |
- os: macos-latest | |
architecture: armv7 # macOS doesn't support ARMv7 | |
- os: windows-latest | |
architecture: armv7 # Windows doesn't support ARMv7 | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for generating changelogs | |
fetch-tags: true # Ensure all tags are fetched | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' # Enables caching for pip dependencies | |
- name: Install dependencies | |
shell: bash # Use bash shell for consistency | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pyinstaller # Install PyInstaller | |
- name: Build with PyInstaller | |
shell: bash | |
run: | | |
pyinstaller --onedir \ | |
--name Money4Band \ | |
main.py \ | |
--hidden-import colorama \ | |
--hidden-import docker \ | |
--hidden-import requests \ | |
--hidden-import pyyaml \ | |
--hidden-import psutil \ | |
--hidden-import yaml \ | |
--hidden-import secrets \ | |
--add-data ".resources:.resources" \ | |
--add-data "config:config" \ | |
--add-data "utils:utils" \ | |
--add-data "legacy_money4bandv3x:legacy_money4bandv3x" \ | |
--add-data "template:template" \ | |
--add-data "LICENSE:LICENSE" \ | |
--add-data "README.md:README.md" \ | |
--contents-directory "." \ | |
-y | |
- name: Archive build artifacts for release (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
Compress-Archive -Path "dist\Money4Band\*" -DestinationPath "Money4Band-${{ matrix.os }}-${{ matrix.architecture }}-${{ github.ref_name }}.zip" | |
- name: Archive build artifacts for release (Unix) | |
if: runner.os != 'Windows' | |
shell: bash | |
run: | | |
tar -czvf "Money4Band-${{ matrix.os }}-${{ matrix.architecture }}-${{ github.ref_name }}.tar.gz" dist/Money4Band | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "Money4Band-${{ matrix.os }}-${{ matrix.architecture }}-${{ github.ref_name }}" | |
path: | | |
Money4Band-${{ matrix.os }}-${{ matrix.architecture }}-${{ github.ref_name }}.zip | |
Money4Band-${{ matrix.os }}-${{ matrix.architecture }}-${{ github.ref_name }}.tar.gz | |
if-no-files-found: error # Fail if no files are found | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for generating changelogs | |
fetch-tags: true # Ensure all tags are fetched | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./artifacts | |
- name: Generate Changelog | |
id: changelog | |
uses: heinrichreimer/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
output: CHANGELOG.md | |
- name: Create a GitHub release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: "Money4Band ${{ github.ref_name }}" | |
tag_name: "${{ github.ref_name }}" | |
body_path: "./CHANGELOG.md" | |
files: "./artifacts/**/*" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |