packages #203
This file contains 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]+" | |
# Dry-run only | |
workflow_dispatch: | |
schedule: | |
- cron: "0 18 * * SUN" | |
defaults: | |
run: | |
shell: bash -el {0} | |
env: | |
PACKAGE: "geoviews" | |
PYTHON_VERSION: "3.11" | |
NODE_VERSION: "20" | |
MPLBACKEND: "Agg" | |
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" | |
jobs: | |
waiting_room: | |
name: Waiting Room | |
runs-on: ubuntu-latest | |
needs: [conda_build, pip_install, npm_build] | |
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" | |
conda_build: | |
name: Build Conda | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: "100" | |
- name: Fetch unshallow | |
run: git fetch --prune --tags --unshallow -f | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniconda-version: "latest" | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: conda setup | |
run: | | |
conda install -y conda-build build pyct | |
- name: conda build | |
run: | | |
source ./scripts/conda/build.sh | |
echo "CONDA_FILE="$CONDA_PREFIX/conda-bld/noarch/$PACKAGE-$VERSION-py_0.tar.bz2"" >> $GITHUB_ENV | |
echo "CONDA_CORE_FILE="$CONDA_PREFIX/conda-bld/noarch/$PACKAGE-core-$VERSION-py_0.tar.bz2"" >> $GITHUB_ENV | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: conda | |
path: | | |
${{ env.CONDA_FILE }} | |
${{ env.CONDA_CORE_FILE }} | |
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@v4 | |
with: | |
name: conda | |
path: dist/ | |
- name: Set environment variables | |
run: | | |
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
echo "CONDA_FILE=$(ls dist/*.tar.bz2 | grep -v core)" >> $GITHUB_ENV | |
echo "CONDA_CORE_FILE=$(ls dist/*-core-*.tar.bz2)" >> $GITHUB_ENV | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniconda-version: "latest" | |
- 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.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev $CONDA_FILE | |
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev $CONDA_CORE_FILE | |
- name: conda main upload | |
if: (!(contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc'))) | |
run: | | |
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev --label=main $CONDA_FILE | |
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev --label=main $CONDA_CORE_FILE | |
pip_build: | |
name: Build PyPI | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: "100" | |
- name: Fetch unshallow | |
run: git fetch --prune --tags --unshallow -f | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install build | |
run: | | |
python -m pip install build | |
- name: Build package | |
run: python -m build . | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: 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@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: pip | |
path: dist/ | |
- name: Install package | |
run: python -m pip install dist/*.whl | |
- name: Test package | |
run: python -c "import $PACKAGE; print($PACKAGE.__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/') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: pip | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: ${{ secrets.PPU }} | |
password: ${{ secrets.PPP }} | |
repository-url: "https://upload.pypi.org/legacy/" | |
npm_build: | |
name: Build NPM | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: "100" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Fetch unshallow | |
run: git fetch --prune --tags --unshallow -f | |
- name: package install | |
run: | | |
python -m pip install -ve . | |
- name: npm build | |
run: | | |
cd ${{ env.PACKAGE }} | |
TARBALL=$(npm pack .) | |
echo "TARBALL=$TARBALL" >> $GITHUB_ENV | |
npm publish --dry-run $TARBALL | |
cd .. | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: npm | |
if-no-files-found: error | |
path: ${{ env.PACKAGE }}/${{ env.TARBALL }} | |
npm_publish: | |
name: Publish NPM | |
runs-on: "ubuntu-latest" | |
needs: [npm_build, waiting_room] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: npm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Set environment variables | |
run: | | |
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
echo "TARBALL=$(ls *.tgz)" >> $GITHUB_ENV | |
- name: npm setup | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_API_TOKEN }}" > $HOME/.npmrc | |
npm whoami | |
npm -v | |
- name: npm dev deploy | |
if: contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc') | |
run: | | |
npm publish --tag dev $TARBALL | |
- name: npm main deploy | |
if: (!(contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc'))) | |
run: | | |
npm publish --tag latest $TARBALL |