Publish #10
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: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: python -m pip install build | |
| - uses: prefix-dev/setup-pixi@v0.10.0 | |
| with: | |
| pixi-version: v0.71.3 | |
| auth-host: prefix.dev | |
| auth-token: ${{ secrets.PREFIX_API_KEY }} | |
| - name: Get version | |
| run: | | |
| VERSION=$(python -c 'import tomllib; print("v" + tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])') | |
| echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
| - name: Build PyPI package | |
| run: python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true | |
| - name: Build Prefix.dev package | |
| run: pixi publish --target-dir "$RUNNER_TEMP/binsparse-conda" | |
| - name: Publish to Prefix.dev | |
| env: | |
| PREFIX_API_KEY: ${{ secrets.PREFIX_API_KEY }} | |
| run: >- | |
| pixi upload prefix | |
| --channel willow-ahrens/binsparse | |
| --api-key "$PREFIX_API_KEY" | |
| "$RUNNER_TEMP"/binsparse-conda/*.conda | |
| - name: Create a release | |
| uses: softprops/action-gh-release@v3 | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: Release ${{ env.VERSION }} | |
| make_latest: true | |
| tag_name: ${{ env.VERSION }} |