packages #379
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: packages | |
| 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: | |
| schedule: | |
| - cron: "0 17 * * SUN" | |
| defaults: | |
| run: | |
| shell: bash -e {0} | |
| env: | |
| PACKAGE: "lumen" | |
| PYTHON_VERSION: "3.11" | |
| 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: publish | |
| steps: | |
| - run: echo "All builds have finished, have been approved, and ready to publish" | |
| pixi_lock: | |
| name: Pixi lock | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: holoviz-dev/holoviz_tasks/pixi_lock@v0 | |
| conda_build: | |
| name: Build Conda | |
| needs: [pixi_lock] | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: holoviz-dev/holoviz_tasks/pixi_install@v0 | |
| with: | |
| environments: "build" | |
| download-data: false | |
| install: false | |
| - name: conda build | |
| run: pixi run -e build build-conda | |
| - uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: artifacts-conda | |
| path: dist/*.conda | |
| if-no-files-found: error | |
| conda_publish: | |
| name: Publish Conda | |
| runs-on: ubuntu-latest | |
| needs: [conda_build, waiting_room] | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: artifacts-conda | |
| path: dist/ | |
| - name: anaconda setup | |
| run: | | |
| pipx install anaconda-client | |
| binstar --version | |
| - name: anaconda dev upload | |
| if: contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') | |
| run: | | |
| binstar --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev dist/*.conda | |
| - name: anaconda upload | |
| if: (!(contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc'))) | |
| run: | | |
| binstar --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev --label=main dist/*.conda | |
| pip_build: | |
| name: Build PyPI | |
| needs: [pixi_lock] | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: holoviz-dev/holoviz_tasks/pixi_install@v0 | |
| with: | |
| environments: "build" | |
| download-data: false | |
| install: false | |
| - name: Build package | |
| run: pixi run -e build build-pip | |
| - uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: artifacts-pip | |
| path: dist/ | |
| if-no-files-found: error | |
| pip_install: | |
| name: Install PyPI | |
| runs-on: "ubuntu-latest" | |
| needs: [pip_build] | |
| steps: | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: artifacts-pip | |
| path: dist/ | |
| - name: Install package | |
| run: python -m pip install dist/*.whl | |
| - name: Import package | |
| run: python -c "import $PACKAGE; print($PACKAGE._version.__version__)" | |
| pip_publish: | |
| name: Publish PyPI | |
| runs-on: ubuntu-latest | |
| needs: [pip_build, waiting_room] | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: artifacts-pip | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| announce: | |
| name: Announce GitHub | |
| runs-on: ubuntu-latest | |
| needs: [waiting_room] | |
| permissions: | |
| contents: write | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: artifacts-* | |
| path: artifacts/ | |
| merge-multiple: true | |
| - name: Extract changelog section | |
| run: | | |
| awk -v ver="## Version ${TAG#v}" ' | |
| $0 == ver {flag=1; next} | |
| /^#{2} Version / && flag {exit} | |
| flag && !/^(\*\*.*\*\*)$/ | |
| ' CHANGELOG.md | tee RELEASE_BODY.md | |
| - name: Create draft GitHub release with dist artifacts | |
| if: (!(contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc'))) | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "$TAG" \ | |
| --title "Version ${TAG#v}" \ | |
| --notes-file RELEASE_BODY.md \ | |
| --draft \ | |
| artifacts/* |