Release Build #2
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
| name: Release Build | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| type: choice | |
| description: 'Version Type' | |
| required: true | |
| default: rebuild | |
| options: | |
| - rebuild | |
| - patch | |
| - minor | |
| - major | |
| jobs: | |
| bump_version: | |
| name: Bump Version | |
| runs-on: ubuntu-latest | |
| permissions: write-all | |
| outputs: | |
| current_version: ${{ steps.get_version.outputs.current_version }} | |
| new_version: ${{ steps.bump.outputs.current-version || steps.bump_manual.outputs.current-version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get current version | |
| id: get_version | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type == 'rebuild' }} | |
| run: | | |
| pip install bump-my-version | |
| echo "current_version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT | |
| - name: Bump version | |
| id: bump | |
| uses: callowayproject/bump-my-version@master | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type != 'rebuild' }} | |
| with: | |
| args: ${{ inputs.version_type }} | |
| - name: Bump version (Manual) | |
| id: bump_manual | |
| uses: callowayproject/bump-my-version@master | |
| if: ${{ github.event_name == 'release' }} | |
| with: | |
| args: --new-version ${{ github.ref_name }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| activate-environment: true | |
| - name: Update lockfile | |
| run: uv lock | |
| - name: Commit version bump | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type != 'rebuild' && steps.bump.outputs.bumped == 'true' }} | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| default_author: github_actions | |
| message: "Bump version: ${{ steps.bump.outputs.previous-version }} → ${{ steps.bump.outputs.current-version }}" | |
| push: false # Temporarily push manually because of (https://github.com/EndBug/add-and-commit/issues/713) | |
| tag: "v${{ steps.bump.outputs.current-version }}" | |
| tag_push: "--force" | |
| - name: Commit version bump (Manual) | |
| if: ${{ github.event_name == 'release' && steps.bump.outputs.bumped == 'true' }} | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| default_author: github_actions | |
| message: "Bump version: ${{ steps.bump.outputs.previous-version }} → ${{ steps.bump.outputs.current-version }}" | |
| push: false # Temporarily push manually because of (https://github.com/EndBug/add-and-commit/issues/713) | |
| tag: "v${{ steps.bump.outputs.current-version }}" | |
| tag_push: "--force" | |
| - uses: ad-m/github-push-action@master | |
| name: Push changes | |
| if: ${{ steps.bump.outputs.bumped == 'true' }} | |
| with: | |
| force: true | |
| tags: true | |
| build: | |
| name: Build for ${{ matrix.osname }} | |
| permissions: write-all | |
| runs-on: ${{ matrix.os }} | |
| needs: bump_version | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| osname: Linux | |
| osext: "" | |
| - os: macos-latest | |
| osname: macOS | |
| osext: "" | |
| - os: windows-latest | |
| osname: Windows | |
| osext: ".exe" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| if: ${{ github.event_name == 'release' || github.event.inputs.version_type == 'rebuild' }} | |
| - uses: actions/checkout@v4 | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type != 'rebuild' }} | |
| with: | |
| ref: v${{ needs.bump_version.outputs.new_version }} | |
| - name: Setup Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.13 | |
| - name: Install dependencies | |
| run: pip install . | |
| - id: repo_name | |
| name: Get repository name | |
| uses: ASzc/change-string-case-action@v6 | |
| with: | |
| string: ${{ github.event.repository.name }} | |
| - name: Build executable | |
| uses: Nuitka/Nuitka-Action@main | |
| with: | |
| mode: onefile | |
| script-name: src/${{ steps.repo_name.outputs.lowercase }} | |
| output-dir: build | |
| output-file: ${{ github.event.repository.name }}_v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}_${{ matrix.osname }} | |
| company-name: ${{ github.repository_owner }} | |
| product-name: ${{ github.event.repository.name }} | |
| file-description: ${{ github.event.repository.name }} for ${{ matrix.osname }} (version ${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}) | |
| file-version: ${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }} | |
| product-version: ${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }} | |
| copyright: "Copyright (c) 2026 ${{ github.repository_owner }}" | |
| include-package: rich._unicode_data | |
| - name: Upload release (manual) | |
| if: ${{ github.event_name == 'release' && matrix.os != 'windows-latest' }} | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: build/${{ github.event.repository.name }}_v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}_${{ matrix.osname }}${{ matrix.osext }} | |
| - name: Upload release | |
| if: ${{ github.event_name == 'workflow_dispatch' && matrix.os != 'windows-latest' }} | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: build/${{ github.event.repository.name }}_v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}_${{ matrix.osname }}${{ matrix.osext }} | |
| tag_name: v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }} | |
| - name: Upload windows release for code signing | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
| AWS_ENDPOINT_URL: ${{ secrets.AWS_ENDPOINT_URL }} | |
| run: aws s3 cp ./build/${{ github.event.repository.name }}_v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}_${{ matrix.osname }}${{ matrix.osext }} s3://builds/unsigned/${{ github.event.repository.name }}/v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}/${{ github.event.repository.name }}_v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}_${{ matrix.osname }}${{ matrix.osext }} |