diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 9bd99b5..5478169 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,11 +1,34 @@ name: Build and Release on: - release: - types: [created] + push: + branches: + - main jobs: + create-release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Get version + id: get_version + run: | + VERSION=$(cat version.txt) + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + with: + tag_name: v${{ env.VERSION }} + name: Release v${{ env.VERSION }} + draft: false + prerelease: false + build-windows: + needs: [create-release] runs-on: windows-latest steps: - name: Checkout code @@ -33,6 +56,7 @@ jobs: path: dist/macropad.exe build-linux: + needs: [create-release] runs-on: ubuntu-latest steps: - name: Checkout code @@ -52,49 +76,65 @@ jobs: - name: Build executable run: | pyinstaller macropad_linux.spec + - name: Upload Linux artifact uses: actions/upload-artifact@v3 with: name: macropad-linux path: dist/macropad - build-macos: - runs-on: macos-latest +# MacOS build is temporarily disabled +# Uncomment this section when macOS build environment becomes available +# +# build-macos: +# needs: [create-release] +# runs-on: macos-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# +# - name: Set up Python +# uses: actions/setup-python@v4 +# with: +# python-version: '3.11' +# +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# pip install pyinstaller +# pip install -r requirements.txt +# +# - name: Build executable +# run: | +# pyinstaller macropad_macos.spec +# +# - name: Upload macOS artifact +# uses: actions/upload-artifact@v3 +# with: +# name: macropad-macos +# path: dist/macropad.app + + attach-to-release: + needs: [create-release, build-windows, build-linux] + runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pyinstaller - pip install -r requirements.txt - - - name: Build executable - run: | - pyinstaller macropad_macos.spec - - name: Upload macOS artifact - uses: actions/upload-artifact@v3 - with: - name: macropad-macos - path: dist/macropad.app - attach-to-release: - needs: [build-windows, build-linux, build-macos] - runs-on: ubuntu-latest - steps: + - name: Get version + id: get_version + run: | + VERSION=$(cat version.txt) + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Download all artifacts uses: actions/download-artifact@v3 - name: Attach executables to release uses: softprops/action-gh-release@v1 with: + tag_name: v${{ env.VERSION }} files: | macropad-windows/macropad.exe macropad-linux/macropad - macropad-macos/macropad.app/**/* +# macropad-macos/macropad.app/**/*