Merge pull request #77 from bl4ckswordsman/add-github-update-checker #39
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 | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build_windows: | |
runs-on: windows-latest | |
defaults: | |
run: | |
working-directory: monitor-app | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pillow # Pillow for icon conversion | |
- name: Build executable | |
run: | | |
pyinstaller --clean disco_beacon.spec | |
- name: Set VERSION | |
run: | | |
$env:VERSION = $env:GITHUB_REF -replace 'refs/tags/v', '' | |
echo "VERSION=$env:VERSION" >> $env:GITHUB_ENV | |
- name: Create archive | |
run: | | |
Compress-Archive -Path .\dist\DiscoBeacon.exe -DestinationPath .\DiscoBeacon_Windows_$env:VERSION.zip | |
- name: Debug List Files | |
run: | | |
Get-ChildItem -Path . -Recurse | |
- name: Echo file name | |
run: | | |
echo "File name: DiscoBeacon_Windows_$env:VERSION.zip" | |
Get-ChildItem -Path . -Filter DiscoBeacon_Windows_*.zip | |
- name: Upload Windows artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: DiscoBeacon_Windows | |
path: ${{ github.workspace }}/monitor-app/DiscoBeacon_Windows_${{ env.VERSION }}.zip | |
if-no-files-found: error | |
build_linux: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: monitor-app | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libxkbcommon-x11-0 | |
- name: Build executable | |
run: | | |
pyinstaller --clean disco_beacon.spec | |
- name: Set VERSION | |
run: | | |
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: Create archive | |
run: | | |
tar -czvf ./DiscoBeacon_Linux_${VERSION}.tar.gz -C ./dist DiscoBeacon | |
- name: Debug List Files | |
run: | | |
find . -type f | |
- name: Echo file name | |
run: | | |
echo "File name: DiscoBeacon_Linux_${VERSION}.tar.gz" | |
ls ./DiscoBeacon_Linux_*.tar.gz | |
- name: Upload Linux artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: DiscoBeacon_Linux | |
path: ${{ github.workspace }}/monitor-app/DiscoBeacon_Linux_${{ env.VERSION }}.tar.gz | |
if-no-files-found: error | |
create_release: | |
needs: [build_windows, build_linux] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set VERSION | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: Download Windows artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: DiscoBeacon_Windows | |
- name: Download Linux artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: DiscoBeacon_Linux | |
- name: Debug List Downloaded Files | |
run: | | |
ls -R | |
- name: Check if release exists | |
id: check_release | |
run: | | |
RELEASE_EXISTS=$(gh release view ${{ github.ref_name }} > /dev/null 2>&1 && echo "true" || echo "false") | |
echo "RELEASE_EXISTS=$RELEASE_EXISTS" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
if: env.RELEASE_EXISTS == 'false' | |
run: | | |
gh release create ${{ github.ref_name }} \ | |
--title "Release ${{ env.VERSION }}" \ | |
--generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release Assets | |
run: | | |
gh release upload ${{ github.ref_name }} \ | |
DiscoBeacon_Windows_${{ env.VERSION }}.zip \ | |
DiscoBeacon_Linux_${{ env.VERSION }}.tar.gz \ | |
--clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |