CI: add smarter release management #1
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
| # pyinstaller --console --one-file .\sourcehold\__main__.py | |
| name: Python package | |
| on: | |
| workflow_dispatch: {} | |
| push: {} | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build_deps: | |
| permissions: | |
| contents: write | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| # os: [ubuntu-latest, windows-latest, macOS-latest] | |
| os: [windows-latest, ubuntu-latest, macOS-latest] | |
| platform: [x86] | |
| python-version: ['3.13'] | |
| python-platform: [x86] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: ${{ matrix.python-platform }} | |
| - name: Enable Developer Command Prompt | |
| uses: ilammy/[email protected] | |
| with: | |
| arch: ${{ matrix.python-platform }} | |
| if: matrix.os == 'windows-latest' | |
| - name: Install dependencies | |
| shell: bash | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install --upgrade wheel setuptools Cython | |
| pip install flake8 pytest | |
| pip install -r requirements.txt | |
| python -m pip install pyinstaller | |
| - name: Run pyinstaller | |
| shell: bash | |
| run: | | |
| pyinstaller --console --onefile ./sourcehold/__main__.py --name sourcehold | |
| - name: Ensure release exists | |
| if: github.ref_type == 'tag' | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| # Set continue on error to true | |
| set +e | |
| if [[ "$(gh --repo sourcehold/sourcehold-maps release view $RELEASE_TAG 2>&1)" == "release not found" ]]; then | |
| set -e | |
| gh --repo sourcehold/sourcehold-maps release create ${{ github.ref_name }} --latest | |
| fi | |
| - name: Upload pyinstaller to release | |
| if: github.ref_type == 'tag' | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh --repo sourcehold/sourcehold-maps release upload ${{ github.ref_name }} dist/sourcehold* |