Publish #220
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
| name: Publish | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: "Dry run: build and test everything, but skip publishing to PyPI, GHCR, and GitHub releases" | |
| type: boolean | |
| default: true | |
| jobs: | |
| build-python-package: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - uses: astral-sh/setup-uv@v8.2.0 | |
| with: | |
| enable-cache: true | |
| - name: Build | |
| run: uv build --no-sources | |
| - name: Upload dists | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| if-no-files-found: error | |
| publish-python-package: | |
| needs: build-python-package | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download dists | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish to PyPI | |
| if: github.event_name == 'release' || inputs.dry_run == 'false' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| windows-installer: | |
| runs-on: windows-latest | |
| needs: build-python-package | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Sanitize version tag | |
| id: tag | |
| shell: bash | |
| run: echo "tag=$(echo '${{ github.ref_name }}' | tr '/' '-')" >> $GITHUB_OUTPUT | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - uses: astral-sh/setup-uv@v8.2.0 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv pip install --system ".[gui]" pyinstaller | |
| - name: Install Inno Setup | |
| uses: crazy-max/ghaction-chocolatey@v3 | |
| with: | |
| args: install innosetup -y --allow-unofficial --force | |
| - name: Run PyInstaller | |
| run: pyinstaller ./deeplc.spec --clean --noconfirm | |
| - name: Test built executable | |
| run: dist/deeplc/deeplc.exe predict --help | |
| - name: Run Inno Setup | |
| run: ISCC.exe ./deeplc_innosetup.iss /DAppVersion=${{ steps.tag.outputs.tag }} | |
| - name: Upload installer artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: windows-installer | |
| path: dist/*.exe | |
| - name: Upload installer to release | |
| if: github.event_name == 'release' || inputs.dry_run == 'false' | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ github.ref }} | |
| file_glob: true | |
| file: dist/*.exe | |
| build-docker-image: | |
| runs-on: ubuntu-latest | |
| needs: build-python-package | |
| permissions: | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Sanitize image tag | |
| id: tag | |
| run: echo "tag=$(echo '${{ github.ref_name }}' | tr '/' '-')" >> $GITHUB_OUTPUT | |
| - name: Login to GitHub Container Registry | |
| if: github.event_name == 'release' || inputs.dry_run == 'false' | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push to ghcr.io | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: docker/Dockerfile | |
| push: ${{ github.event_name == 'release' || inputs.dry_run == 'false' }} | |
| tags: | | |
| ghcr.io/compomics/deeplc:${{ steps.tag.outputs.tag }} | |
| ${{ github.event_name == 'release' && 'ghcr.io/compomics/deeplc:latest' || '' }} | |
| - name: Test Docker image | |
| if: github.event_name == 'release' || inputs.dry_run == 'false' | |
| run: docker run --rm ghcr.io/compomics/deeplc:${{ steps.tag.outputs.tag }} deeplc --help |