Skip to content

🚚🌍 Publish to πŸ”¬β˜• SciJava and πŸŽͺ PyPI #47

🚚🌍 Publish to πŸ”¬β˜• SciJava and πŸŽͺ PyPI

🚚🌍 Publish to πŸ”¬β˜• SciJava and πŸŽͺ PyPI #47

Workflow file for this run

name: 🚚🌍 Publish to πŸ”¬β˜• SciJava and πŸŽͺ PyPI
on:
workflow_dispatch:
push:
branches:
- master
tags:
- "python-imcflibs-[0-9]+.*"
pull_request:
branches:
- master
jobs:
# publish-to-scijava:
# name: πŸ”¬β˜• publish via β“‚ Maven to SciJava
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# name: πŸ“₯ Checkout repo
# - name: β˜• Set up Java
# uses: actions/setup-java@v3
# with:
# java-version: '8'
# distribution: 'zulu'
# cache: 'maven'
# - name: πŸͺ Set up CI environment
# run: .github/setup.sh
# - name: πŸ‘· Build and publish on πŸ”¬β˜• SciJava
# run: .github/build.sh
# env:
# GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
# GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# MAVEN_USER: ${{ secrets.MAVEN_USER }}
# MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
# OSSRH_PASS: ${{ secrets.OSSRH_PASS }}
# SIGNING_ASC: ${{ secrets.SIGNING_ASC }}
build-via-poetry:
name: πŸ‘· build via 🎭 Poetry
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
name: πŸ“₯ Checkout repo
- name: πŸ—ƒ Cache πŸ“¦ APT Packages
uses: awalsh128/[email protected]
with:
packages: xmlstarlet
version: 1.0
- name: πŸ•΅ Inspect if this is a proper "scijava-scripts" release
run: scripts/check-if-release.sh
- name: 🐍 Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: πŸ—ƒ Cache 🎭 Poetry install
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-2.0.1-0
# The key configuration value here is `virtualenvs-in-project: true`: this
# creates the venv as a `.venv` in your testing directory, which allows
# the next step to easily cache it.
- name: πŸ”©πŸ”§ Install 🎭 Poetry
uses: snok/install-poetry@v1
with:
version: 2.0.1
virtualenvs-create: true
virtualenvs-in-project: true
### No dependencies and project installation required, we're just packaging.
# # Cache dependencies (i.e. all the stuff in your `pyproject.toml`).
# - name: πŸ—ƒ Cache 🧾 Dependencies
# id: cache-deps
# uses: actions/cache@v4
# with:
# path: .venv
# key: pydeps-${{ hashFiles('**/poetry.lock') }}
### No poetry-dynamic-versioning here, we're using the POM instead!
# - name: 🎭 Install Poetry dynamic-versioning πŸ”Œ plugin
# run: poetry self add "poetry-dynamic-versioning[plugin]"
### No dependencies and project installation required, we're just packaging.
# # Install dependencies. `--no-root` means "install all dependencies but
# # not the project itself", which is what you want to avoid caching _your_
# # code. The `if` statement ensures this only runs on a cache miss.
# - name: 🎭 Install 🧾 Dependencies
# run: scripts/run-poetry.sh install --no-interaction --no-root
# if: steps.cache-deps.outputs.cache-hit != 'true'
# - name: 🎭 Install πŸ›– project
# run: scripts/run-poetry.sh install --no-interaction
- name: πŸŽ­πŸ‘· Build 🧱 project
run: scripts/run-poetry.sh build
env:
IGNORE_DEPS_PYTHON: true # required to build "py2.py3" wheels
- name: πŸ“€ Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/
publish-to-pypi:
name: 🚚🌍 publish to πŸŽͺ PyPI
runs-on: ubuntu-latest
needs:
- build-via-poetry
permissions:
id-token: write
environment:
name: release
steps:
- name: πŸ“₯ Retrieve release πŸ“¦ distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: πŸ₯ Publish release distributions to πŸŽͺ PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
trigger-foreign-workflows:
name: πŸš€ Dispatch foreign workflows
strategy:
matrix:
repo: ['imcf/imcf.github.io']
runs-on: ubuntu-latest
needs:
- publish-to-pypi
steps:
- name: 🏹 Fire event on `${{ matrix.repo }}`
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DISPATCH_DEPLOY_PAGES }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ matrix.repo }}/dispatches \
-d '{"event_type":"dispatch-event"}'