1- name : build
1+ name : ππ Publish to π¬β SciJava and πͺ PyPI
22
33on :
4+ workflow_dispatch :
5+
46 push :
57 branches :
68 - master
79 tags :
8- - " * -[0-9]+.*"
10+ - " python-imcflibs -[0-9]+.*"
911 pull_request :
1012 branches :
1113 - master
1214
15+
1316jobs :
14- build :
17+
18+ publish-to-scijava :
19+
20+ name : π¬β publish to SciJava
21+
1522 runs-on : ubuntu-latest
1623
1724 steps :
18- - uses : actions/checkout@v2
19- - name : Set up Java
25+
26+ - uses : actions/checkout@v4
27+ name : π₯ Checkout repo
28+
29+ - name : β Set up Java
2030 uses : actions/setup-java@v3
2131 with :
2232 java-version : ' 8'
2333 distribution : ' zulu'
2434 cache : ' maven'
25- - name : Set up CI environment
35+
36+ - name : πͺ Set up CI environment
2637 run : .github/setup.sh
27- - name : Execute the build
38+
39+ - name : π· Build and publish on π¬β SciJava
2840 run : .github/build.sh
2941 env :
3042 GPG_KEY_NAME : ${{ secrets.GPG_KEY_NAME }}
@@ -33,3 +45,132 @@ jobs:
3345 MAVEN_PASS : ${{ secrets.MAVEN_PASS }}
3446 OSSRH_PASS : ${{ secrets.OSSRH_PASS }}
3547 SIGNING_ASC : ${{ secrets.SIGNING_ASC }}
48+
49+
50+ build-via-poetry :
51+
52+ name : π· build via π Poetry
53+
54+ runs-on : ubuntu-22.04
55+
56+ steps :
57+ - uses : actions/checkout@v4
58+ name : π₯ Checkout repo
59+
60+ - name : π Cache π¦ APT Packages
61+ uses : awalsh128/cache-apt-pkgs-action@v1.4.3
62+ with :
63+ packages : xmlstarlet
64+ version : 1.0
65+
66+ - name : π΅ Inspect if this is a proper "scijava-scripts" release
67+ run : scripts/check-if-release.sh
68+
69+ - name : π Set up Python
70+ uses : actions/setup-python@v5
71+ with :
72+ python-version : " 3.10"
73+
74+ - name : π Cache π Poetry install
75+ uses : actions/cache@v4
76+ with :
77+ path : ~/.local
78+ key : poetry-2.0.1-0
79+
80+ # The key configuration value here is `virtualenvs-in-project: true`: this
81+ # creates the venv as a `.venv` in your testing directory, which allows
82+ # the next step to easily cache it.
83+ - name : π©π§ Install π Poetry
84+ uses : snok/install-poetry@v1
85+ with :
86+ version : 2.0.1
87+ virtualenvs-create : true
88+ virtualenvs-in-project : true
89+
90+ # ## No dependencies and project installation required, we're just packaging.
91+ # # Cache dependencies (i.e. all the stuff in your `pyproject.toml`).
92+ # - name: π Cache π§Ύ Dependencies
93+ # id: cache-deps
94+ # uses: actions/cache@v4
95+ # with:
96+ # path: .venv
97+ # key: pydeps-${{ hashFiles('**/poetry.lock') }}
98+
99+ # ## No poetry-dynamic-versioning here, we're using the POM instead!
100+ # - name: π Install Poetry dynamic-versioning π plugin
101+ # run: poetry self add "poetry-dynamic-versioning[plugin]"
102+
103+ # ## No dependencies and project installation required, we're just packaging.
104+ # # Install dependencies. `--no-root` means "install all dependencies but
105+ # # not the project itself", which is what you want to avoid caching _your_
106+ # # code. The `if` statement ensures this only runs on a cache miss.
107+ # - name: π Install π§Ύ Dependencies
108+ # run: scripts/run-poetry.sh install --no-interaction --no-root
109+ # if: steps.cache-deps.outputs.cache-hit != 'true'
110+
111+ # - name: π Install π project
112+ # run: scripts/run-poetry.sh install --no-interaction
113+
114+ - name : ππ· Build π§± project
115+ run : scripts/run-poetry.sh build
116+ env :
117+ IGNORE_DEPS_PYTHON : true # required to build "py2.py3" wheels
118+
119+ - name : π€ Upload build artifacts
120+ uses : actions/upload-artifact@v4
121+ with :
122+ name : release-dists
123+ path : dist/
124+
125+
126+ publish-to-pypi :
127+
128+ name : ππ publish to πͺ PyPI
129+
130+ runs-on : ubuntu-latest
131+
132+ needs :
133+ - build-via-poetry
134+
135+ permissions :
136+ id-token : write
137+
138+ environment :
139+ name : release
140+
141+ steps :
142+ - name : π₯ Retrieve release π¦ distributions
143+ uses : actions/download-artifact@v4
144+ with :
145+ name : release-dists
146+ path : dist/
147+
148+ - name : π₯ Publish release distributions to πͺ PyPI
149+ uses : pypa/gh-action-pypi-publish@release/v1
150+ with :
151+ packages-dir : dist/
152+
153+
154+ trigger-foreign-workflows :
155+
156+ name : π Dispatch foreign workflows
157+
158+ strategy :
159+ matrix :
160+ repo : ['imcf/imcf.github.io']
161+
162+ runs-on : ubuntu-latest
163+
164+ needs :
165+ - publish-to-pypi
166+
167+ steps :
168+ - name : πΉ Fire event on `${{ matrix.repo }}`
169+ run : |
170+ curl -L \
171+ -X POST \
172+ -H "Accept: application/vnd.github+json" \
173+ -H "Authorization: Bearer ${{ secrets.DISPATCH_DEPLOY_PAGES }}" \
174+ -H "X-GitHub-Api-Version: 2022-11-28" \
175+ https://api.github.com/repos/${{ matrix.repo }}/dispatches \
176+ -d '{"event_type":"dispatch-event"}'
0 commit comments