added pre-release tag for alpha versions #58
Workflow file for this run
This file contains hidden or 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
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| name: Release Multi Platform | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_alpha: ${{ steps.release_type.outputs.is_alpha }} | |
| is_beta: ${{ steps.release_type.outputs.is_beta }} | |
| app_name: ${{ steps.app_info.outputs.app_name }} | |
| version: ${{ steps.app_info.outputs.version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Determine Release Type | |
| id: release_type | |
| run: | | |
| TAG="${GITHUB_REF##*/}" | |
| if [[ "$TAG" == *alpha* || "$TAG" == *Alpha* || "$TAG" == *ALPHA* ]]; then | |
| echo "is_alpha=true" >> $GITHUB_OUTPUT | |
| echo "is_beta=false" >> $GITHUB_OUTPUT | |
| elif [[ "$TAG" == *beta* || "$TAG" == *Beta* || "$TAG" == *BETA* ]]; then | |
| echo "is_alpha=false" >> $GITHUB_OUTPUT | |
| echo "is_beta=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_alpha=false" >> $GITHUB_OUTPUT | |
| echo "is_beta=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Extract App Info from base.json | |
| id: app_info | |
| run: | | |
| jq --version || sudo apt-get update && sudo apt-get install -y jq | |
| APP_NAME=$(jq -r '.app_name' src/build/settings/base.json) | |
| VERSION=$(jq -r '.version' src/build/settings/base.json) | |
| echo "app_name=$APP_NAME" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| id: create_release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ github.ref }} | |
| name: Release ${{ github.ref_name }} | |
| bodyFile: release_text.md | |
| draft: false | |
| prerelease: ${{ steps.release_type.outputs.is_alpha || steps.release_type.outputs.is_beta }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-linux: | |
| name: Build Ubuntu | |
| needs: create-release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements/base.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install fpm | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ruby ruby-dev rubygems build-essential jq | |
| sudo gem install --no-document --minimal-deps fpm | |
| fpm --version | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Python dependencies | |
| run: pip install -r requirements/base.txt | |
| - name: Run ppg | |
| run: | | |
| ppg freeze | |
| ppg installer | |
| - name: Debug - List target contents | |
| run: ls -R target || true | |
| - name: Upload to Release | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: target/${{ needs.create-release.outputs.app_name }}${{ needs.create-release.outputs.is_alpha == 'true' || needs.create-release.outputs.is_beta == 'true' && ' Beta' || '' }}.deb | |
| asset_name: ${{ needs.create-release.outputs.app_name }}${{ needs.create-release.outputs.is_alpha == 'true' || needs.create-release.outputs.is_beta == 'true' && ' Beta' || '' }}-${{ needs.create-release.outputs.version }}.deb | |
| tag: ${{ github.ref }} | |
| overwrite: true | |
| build-macos: | |
| name: Build macOS | |
| needs: create-release | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements/base.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Python dependencies | |
| run: pip install -r requirements/base.txt | |
| - name: Run ppg | |
| run: | | |
| ppg freeze | |
| ppg installer | |
| - name: Debug - List target contents | |
| run: ls -R target || true | |
| - name: Upload to Release | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: target/${{ needs.create-release.outputs.app_name }}${{ needs.create-release.outputs.is_alpha == 'true' || needs.create-release.outputs.is_beta == 'true' && ' Beta' || '' }}.dmg | |
| asset_name: ${{ needs.create-release.outputs.app_name }}${{ needs.create-release.outputs.is_alpha == 'true' || needs.create-release.outputs.is_beta == 'true' && ' Beta' || '' }}-${{ needs.create-release.outputs.version }}.dmg | |
| tag: ${{ github.ref }} | |
| overwrite: true | |
| build-windows: | |
| name: Build Windows | |
| needs: create-release | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~\AppData\Local\pip\Cache | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements/base.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Visual C++ 2010 Redistributable | |
| run: choco install vcredist2010 --yes | |
| - name: Install NSIS and verify | |
| shell: cmd | |
| run: | | |
| choco install nsis --yes | |
| call RefreshEnv.cmd | |
| makensis /VERSION | |
| - name: Install Python dependencies | |
| run: pip install -r requirements/base.txt | |
| - name: Run ppg | |
| run: | | |
| ppg freeze | |
| ppg installer | |
| - name: Debug - List target contents | |
| run: dir target /s || exit 0 | |
| - name: Upload to Release | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: target/${{ needs.create-release.outputs.app_name }}${{ needs.create-release.outputs.is_alpha == 'true' || needs.create-release.outputs.is_beta == 'true' && ' Beta' || '' }}Setup.exe | |
| asset_name: ${{ needs.create-release.outputs.app_name }}${{ needs.create-release.outputs.is_alpha == 'true' || needs.create-release.outputs.is_beta == 'true' && ' Beta' || '' }}-${{ needs.create-release.outputs.version }}.exe | |
| tag: ${{ github.ref }} | |
| overwrite: true | |
| rollback-release: | |
| name: Rollback | |
| if: ${{ failure() }} | |
| needs: [build-linux, build-macos, build-windows] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Rollback | |
| uses: author/action-rollback@1.0.4 | |
| with: | |
| tag: ${{ github.ref }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |