Skip to content

Commit

Permalink
cicd: update
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkShawn2020 committed Dec 17, 2024
1 parent d71cdf3 commit 47e015f
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
python-version: ["3.11"]
include:
- os: windows-latest
asset_name: watchcat.exe
asset_path: dist/watchcat.exe
asset_name: watchcat-windows-${{ github.ref_name }}.exe
asset_path: ./dist/watchcat-windows-${{ github.ref_name }}.exe
- os: ubuntu-latest
asset_name: watchcat-linux
asset_path: dist/watchcat
asset_name: watchcat-linux-${{ github.ref_name }}
asset_path: ./dist/watchcat-linux-${{ github.ref_name }}
- os: macos-latest
asset_name: watchcat-macos
asset_path: dist/watchcat
asset_name: watchcat-macos-${{ github.ref_name }}
asset_path: ./dist/watchcat-macos-${{ github.ref_name }}

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -97,19 +97,36 @@ jobs:

- name: Build with PyInstaller
run: |
poetry run pyinstaller --clean --onefile --windowed --name watchcat transparent_overlay/main.py
- name: Rename Linux/macOS binary
if: runner.os != 'Windows'
if [ "${{ runner.os }}" = "Windows" ]; then
poetry run pyinstaller --clean --onefile --windowed --name watchcat-windows transparent_overlay/main.py
elif [ "${{ runner.os }}" = "Linux" ]; then
poetry run pyinstaller --clean --onefile --windowed --name watchcat-linux transparent_overlay/main.py
else
poetry run pyinstaller --clean --onefile --windowed --name watchcat-macos transparent_overlay/main.py
fi
shell: bash

- name: List dist directory
run: ls -la dist/
shell: bash

- name: Rename with version
run: |
mv dist/watchcat "dist/${{ matrix.asset_name }}"
if [ "${{ runner.os }}" = "Windows" ]; then
mv "./dist/watchcat-windows.exe" "./dist/watchcat-windows-${{ github.ref_name }}.exe"
elif [ "${{ runner.os }}" = "Linux" ]; then
mv "./dist/watchcat-linux" "./dist/watchcat-linux-${{ github.ref_name }}"
else
mv "./dist/watchcat-macos" "./dist/watchcat-macos-${{ github.ref_name }}"
fi
shell: bash

- name: Upload Release Asset
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ matrix.asset_path }}
files: ./dist/watchcat-*-${{ github.ref_name }}*
draft: false
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }}
generate_release_notes: true
Expand All @@ -118,8 +135,9 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: watchcat-${{ matrix.os }}
path: ${{ matrix.asset_path }}
name: ${{ matrix.asset_name }}
path: ./dist/watchcat-*-${{ github.ref_name }}*
if-no-files-found: error

create-release:
needs: build
Expand Down

0 comments on commit 47e015f

Please sign in to comment.