update pixi in publish workflow #17
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: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| - "v[0-9]+.[0-9]+.[0-9]+a[0-9]+" | |
| - "v[0-9]+.[0-9]+.[0-9]+b[0-9]+" | |
| - "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+" | |
| workflow_dispatch: | |
| env: | |
| PACKAGE: "luminet" | |
| PYTHON_VERSION: "3.8" | |
| jobs: | |
| waiting_room: | |
| name: Waiting Room | |
| runs-on: ubuntu-latest | |
| needs: [conda_build, pip_install] | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| environment: | |
| name: deploy | |
| steps: | |
| - run: echo "All builds have finished, have been approved, and ready to publish" | |
| pip_build: | |
| name: Build sdist & wheel | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: prefix-dev/setup-pixi@v0.9.3 | |
| with: | |
| pixi-version: v0.62.2 | |
| cache: true | |
| auth-host: prefix.dev | |
| auth-token: ${{ secrets.PREFIX_DEV_TOKEN }} | |
| - name: Build package | |
| run: | | |
| pixi r -e build python -m build | |
| pixi r -e build twine check dist/* | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: pip | |
| path: dist/ | |
| if-no-files-found: error | |
| pip_install: | |
| name: Test pip install from wheel | |
| runs-on: "ubuntu-latest" | |
| needs: [pip_build] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: pip | |
| path: dist/ | |
| - uses: prefix-dev/setup-pixi@v0.8.2 | |
| with: | |
| pixi-version: v0.41.3 | |
| cache: true | |
| auth-host: prefix.dev | |
| auth-token: ${{ secrets.PREFIX_DEV_TOKEN }} | |
| - name: Install package | |
| run: | | |
| pixi r -e build python -m pip install dist/*.whl | |
| - name: Import package | |
| run: pixi r python -c "import $PACKAGE; print($PACKAGE.__version__)" | |
| pip_publish: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: [waiting_room] | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| id-token: write | |
| contents: write | |
| environment: PyPI | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: pip | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| conda_build: | |
| name: Build .conda package | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: prefix-dev/setup-pixi@v0.8.2 | |
| with: | |
| pixi-version: v0.41.3 | |
| cache: true | |
| auth-host: prefix.dev | |
| auth-token: ${{ secrets.PREFIX_DEV_TOKEN }} | |
| - name: Build .conda | |
| run: pixi build -o dist/ | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: conda | |
| path: "dist/*.conda" | |
| if-no-files-found: error | |
| conda_publish: | |
| name: Publish to conda-forge | |
| runs-on: ubuntu-latest | |
| needs: [waiting_room] | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: conda | |
| path: dist/ | |
| - name: Set environment variables | |
| run: | | |
| echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
| echo "CONDA_FILE=$(ls dist/*.conda)" >> $GITHUB_ENV | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniconda-version: "latest" | |
| channels: "conda-forge" | |
| - name: conda setup | |
| run: | | |
| conda install -y anaconda-client | |
| - name: conda dev upload | |
| if: contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc') | |
| run: | | |
| anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --skip-existing --user bgmeulem --label=dev $CONDA_FILE | |
| - name: conda main upload | |
| if: (!(contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc'))) | |
| run: | | |
| anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --skip-existing --user bgmeulem --label=dev --label=main $CONDA_FILE |