1- name : build 
1+ name : ππ Publish to π¬β SciJava and πͺ PyPI 
22
33on :
4-   push :
5-     branches :
6-       - master 
7-     tags :
8-       - " *-[0-9]+.*" 
9-   pull_request :
10-     branches :
11-       - master 
4+ 
5+   release :
6+     types :
7+       - published   #  A release, pre-release, or draft of a release was published.
8+ 
9+   workflow_dispatch :
10+ 
11+   # # Do NOT run on pushes or PR's, as they won't have a 'release.properties',
12+   # # which is required by the build-tooling (see the comment at the "Inspect" /
13+   # # "check-if-release.sh" section below for details).
14+   #  push:
15+   #  pull_request:
16+ 
1217
1318jobs :
14-   build :
19+ 
20+   publish-to-scijava :
21+ 
22+     name : π¬β publish to SciJava 
23+ 
1524    runs-on : ubuntu-latest 
1625
1726    steps :
18-       - uses : actions/checkout@v2 
19-       - name : Set up Java 
27+ 
28+       - uses : actions/checkout@v4 
29+         name : π₯ Checkout repo 
30+ 
31+       - name : β Set up Java 
2032        uses : actions/setup-java@v3 
2133        with :
2234          java-version : ' 8' 
2335          distribution : ' zulu' 
2436          cache : ' maven' 
25-       - name : Set up CI environment 
37+ 
38+       - name : πͺ Set up CI environment 
2639        run : .github/setup.sh 
27-       - name : Execute the build 
40+ 
41+       - name : π· Build and publish on π¬β SciJava 
2842        run : .github/build.sh 
2943        env :
3044          GPG_KEY_NAME : ${{ secrets.GPG_KEY_NAME }} 
@@ -33,3 +47,137 @@ jobs:
3347          MAVEN_PASS : ${{ secrets.MAVEN_PASS }} 
3448          OSSRH_PASS : ${{ secrets.OSSRH_PASS }} 
3549          SIGNING_ASC : ${{ secrets.SIGNING_ASC }} 
50+ 
51+ 
52+   build-via-poetry :
53+ 
54+     name : π· build via π Poetry 
55+ 
56+     runs-on : ubuntu-22.04 
57+ 
58+     steps :
59+     - uses : actions/checkout@v4 
60+       name : π₯ Checkout repo 
61+ 
62+     - name : π Cache π¦ APT Packages 
63+ 64+       with :
65+         packages : xmlstarlet 
66+         version : 1.0 
67+ 
68+     - name : π΅ Inspect if this is a proper "scijava-scripts" release 
69+       run : scripts/check-if-release.sh 
70+       #  This will make sure the file 'release.properties' exists, meaning
71+       #  `release-version.sh` from the 'scijava-scripts' repo has been run to
72+       #  prepare the release and modify 'pom.xml' (which is in turn
73+       #  required by the local 'scripts/run-poetry.sh' script for building the
74+       #  Python package through Poetry.
75+ 
76+     - name : π Set up Python 
77+       uses : actions/setup-python@v5 
78+       with :
79+         python-version : " 3.10" 
80+ 
81+     - name : π Cache π Poetry install 
82+       uses : actions/cache@v4 
83+       with :
84+         path : ~/.local 
85+         key : poetry-2.0.1-0 
86+ 
87+     #  The key configuration value here is `virtualenvs-in-project: true`: this
88+     #  creates the venv as a `.venv` in your testing directory, which allows
89+     #  the next step to easily cache it.
90+     - name : π©π§ Install π Poetry 
91+       uses : snok/install-poetry@v1 
92+       with :
93+         version : 2.0.1 
94+         virtualenvs-create : true 
95+         virtualenvs-in-project : true 
96+ 
97+     # ## No dependencies and project installation required, we're just packaging.
98+     #  # Cache dependencies (i.e. all the stuff in your `pyproject.toml`).
99+     #  - name: π Cache π§Ύ Dependencies
100+     #    id: cache-deps
101+     #    uses: actions/cache@v4
102+     #    with:
103+     #      path: .venv
104+     #      key: pydeps-${{ hashFiles('**/poetry.lock') }}
105+ 
106+     # ## No poetry-dynamic-versioning here, we're using the POM instead!
107+     #  - name: π Install Poetry dynamic-versioning π plugin
108+     #    run: poetry self add "poetry-dynamic-versioning[plugin]"
109+ 
110+     # ## No dependencies and project installation required, we're just packaging.
111+     #  # Install dependencies. `--no-root` means "install all dependencies but
112+     #  # not the project itself", which is what you want to avoid caching _your_
113+     #  # code. The `if` statement ensures this only runs on a cache miss.
114+     #  - name: π Install π§Ύ Dependencies
115+     #    run: scripts/run-poetry.sh install --no-interaction --no-root
116+     #    if: steps.cache-deps.outputs.cache-hit != 'true'
117+ 
118+     #  - name: π Install π project
119+     #    run: scripts/run-poetry.sh install --no-interaction
120+ 
121+     - name : ππ· Build π§± project 
122+       run : scripts/run-poetry.sh build 
123+       env :
124+         IGNORE_DEPS_PYTHON : true   #  required to build "py2.py3" wheels
125+ 
126+     - name : π€ Upload build artifacts 
127+       uses : actions/upload-artifact@v4 
128+       with :
129+         name : release-dists 
130+         path : dist/ 
131+ 
132+ 
133+   publish-to-pypi :
134+ 
135+     name : ππ publish to πͺ PyPI 
136+ 
137+     runs-on : ubuntu-latest 
138+ 
139+     needs :
140+       - build-via-poetry 
141+ 
142+     permissions :
143+       id-token : write 
144+ 
145+     environment :
146+       name : release 
147+ 
148+     steps :
149+       - name : π₯ Retrieve release π¦ distributions 
150+         uses : actions/download-artifact@v4 
151+         with :
152+           name : release-dists 
153+           path : dist/ 
154+ 
155+       - name : π₯ Publish release distributions to πͺ PyPI 
156+         uses : pypa/gh-action-pypi-publish@release/v1 
157+         with :
158+           packages-dir : dist/ 
159+ 
160+ 
161+   trigger-foreign-workflows :
162+ 
163+     name : π Dispatch foreign workflows 
164+ 
165+     strategy :
166+       matrix :
167+         repo : ['imcf/imcf.github.io'] 
168+ 
169+     runs-on : ubuntu-latest 
170+ 
171+     needs :
172+       - publish-to-pypi 
173+ 
174+     steps :
175+       - name : πΉ Fire event on `${{ matrix.repo }}` 
176+         run : | 
177+           curl -L \ 
178+             -X POST \ 
179+             -H "Accept: application/vnd.github+json" \ 
180+             -H "Authorization: Bearer ${{ secrets.DISPATCH_DEPLOY_PAGES }}" \ 
181+             -H "X-GitHub-Api-Version: 2022-11-28" \ 
182+             https://api.github.com/repos/${{ matrix.repo }}/dispatches \ 
183+             -d '{"event_type":"dispatch-event"}' 
0 commit comments