ππ Publish to π¬β SciJava and πͺ PyPI #47
Workflow file for this run
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: ππ 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"}' |