-
Notifications
You must be signed in to change notification settings - Fork 3
176 lines (132 loc) Β· 4.64 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
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"}'