chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.1… #81
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/test.yml | |
| publish-conda-pkg-to-anaconda-dot-org: | |
| name: Publish conda package to Anaconda.org | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| steps: | |
| - name: Retrieve the source code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create build environment | |
| run: | | |
| source $CONDA/bin/activate | |
| conda create -n build --file ./etc/build.linux-64.lock | |
| - name: Download the build artifacts | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: conda-${{ github.sha }} | |
| path: ./conda-bld | |
| - name: publish | |
| env: | |
| TOKEN: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} | |
| run: | | |
| source $CONDA/bin/activate && conda activate build | |
| # If it's not a tagged release, publish to dev label | |
| [[ "$GITHUB_REF" =~ ^refs/tags/v ]] || export LABEL="--label dev" | |
| anaconda --verbose \ | |
| --token $TOKEN \ | |
| upload \ | |
| --user anaconda-cloud \ | |
| $LABEL \ | |
| --force \ | |
| ./conda-bld/noarch/anaconda-* | |
| publish-wheel-to-anaconda-dot-org: | |
| name: Publish wheel to Anaconda.org | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| steps: | |
| - name: Retrieve the source code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download the build artifacts | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: wheel-${{ github.sha }} | |
| path: ./dist | |
| - name: Create build environment | |
| run: | | |
| source $CONDA/bin/activate | |
| conda create -n build --file ./etc/build.linux-64.lock | |
| - name: Upload to anaconda.org | |
| env: | |
| TOKEN: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} | |
| GITHUB_REF: ${{ github.ref }} | |
| run: | | |
| source $CONDA/bin/activate && conda activate build | |
| # If it's not a tagged release, publish to dev label | |
| [[ "$GITHUB_REF" =~ ^refs/tags/v ]] || export LABEL="--label dev" | |
| anaconda --verbose \ | |
| --token $TOKEN \ | |
| upload \ | |
| --user anaconda-cloud \ | |
| $LABEL \ | |
| --force \ | |
| ./dist/*.whl | |
| publish-to-pypi: | |
| name: Build & publish to PyPI | |
| # Only publish to PyPI if a tagged release | |
| if: startsWith(github.event.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - name: Setup Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| - name: Download the build artifacts | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: wheel-${{ github.sha }} | |
| path: ./dist | |
| - name: Install build dependencies | |
| run: pip install twine | |
| - name: Upload to PyPI with twine | |
| run: python -m twine upload ~/dist/* | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |