@@ -18,36 +18,15 @@ jobs:
18
18
deploy-pypi :
19
19
name : PyPI deployment
20
20
runs-on : " ubuntu-latest"
21
- if : github.event_name != 'push' || github.repository == 'DIRACGrid /diracx'
21
+ if : github.event_name != 'push' || github.repository == 'aldbr /diracx'
22
22
outputs :
23
- new-version : ${{ steps.check-tag.outputs.new-version }}
24
23
create-release : ${{ steps.check-tag.outputs.create-release }}
25
- permissions :
26
- id-token : write # IMPORTANT: this permission is mandatory for trusted publishing on pypi
27
- actions : write
28
- checks : write
29
- contents : write
30
- deployments : write
31
- discussions : write
32
- issues : write
33
- packages : write
34
- pages : write
35
- pull-requests : write
36
- repository-projects : write
37
- security-events : write
38
- statuses : write
39
24
defaults :
40
25
run :
41
26
# We need extglob for REFERENCE_BRANCH substitution
42
27
shell : bash -l -O extglob {0}
43
28
steps :
44
29
- uses : actions/checkout@v4
45
- with :
46
- token : ${{ github.token }}
47
- - run : |
48
- git fetch --prune --unshallow
49
- git config --global user.email "[email protected] "
50
- git config --global user.name "DIRACGrid CI"
51
30
- uses : actions/setup-python@v5
52
31
with :
53
32
python-version : ' 3.11'
@@ -60,60 +39,14 @@ jobs:
60
39
readme_renderer[md] \
61
40
requests \
62
41
setuptools_scm
63
- - name : Validate README for PyPI
64
- run : |
65
- python -m readme_renderer README.md -o /tmp/README.html
66
- - name : Prepare release notes
67
- run : |
68
- set -xeuo pipefail
69
- IFS=$'\n\t'
70
- # Needed for the advanced pattern matching used in REFERENCE_BRANCH
71
- PREV_VERSION=$(git describe --tags --abbrev=0)
72
- # In case of manual trigger,
73
- # GITHUB_REF is of the form refs/heads/main -> we want main
74
- # In case of PR it is of the form refs/pull/59/merge -> we want pull/59/merge
75
- REFERENCE_BRANCH=${GITHUB_REF##refs*(/heads)/}
76
- echo "Making release notes for ${REFERENCE_BRANCH} since ${PREV_VERSION}"
77
- (git log ${PREV_VERSION}...${REFERENCE_BRANCH} --oneline --no-merges --) > release.notes.new
78
- cat release.notes.new
79
42
- name : Create tag if required
80
43
id : check-tag
81
44
run : |
82
45
set -xeuo pipefail
83
46
IFS=$'\n\t'
84
47
# Only do a real release for workflow_dispatch events
85
48
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
86
- echo "Will create a real release"
87
- export NEW_VERSION="v${{ github.event.inputs.version }}"
88
- if [[ "${NEW_VERSION}" == "v" ]]; then
89
- # If version wasn't given as an input to the workflow, use setuptools_scm to guess while removing "dev" portion of the version number
90
- NEW_VERSION=v$(python -m setuptools_scm | sed 's@Guessed Version @@g' | sed -E 's@(\.dev|\+g).+@@g')
91
- export NEW_VERSION
92
- fi
93
- echo "Release will be named $NEW_VERSION"
94
- # Validate the version
95
- # Ensure the version doesn't look like a PEP-440 "dev release" (which might happen if the automatic version bump has issues)
96
- python -c $'from packaging.version import Version; v = Version('"'$NEW_VERSION'"$')\nif v.is_devrelease:\n raise ValueError(v)'
97
- # Make sure we always only create pre-releases
98
- python -c $'from packaging.version import Version; v = Version('"'$NEW_VERSION'"$')\nif not v.is_prerelease:\n raise ValueError("integration should only be used for pre-releases")'
99
- # Commit the release notes
100
- mv release.notes release.notes.old
101
- cat release.notes.old
102
- (echo -e "[${NEW_VERSION}]" && cat release.notes.new release.notes.old) > release.notes
103
- ###################3
104
- # TODO: we should add the release notes somewhere at some point
105
- # now we just don't do it because main branch is protected
106
- # and we can't push directly from the CI
107
- #git add release.notes
108
- #git commit -m "docs: Add release notes for $NEW_VERSION"
109
- # Stash is mandatory not to leave the repo dirty
110
- git stash
111
- ########################
112
- git show
113
- # Create the tag
114
- git tag "$NEW_VERSION"
115
49
echo "create-release=true" >> $GITHUB_OUTPUT
116
- echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
117
50
fi
118
51
- name : Build distributions
119
52
run : |
@@ -129,96 +62,6 @@ jobs:
129
62
name : diracx-whl
130
63
path : dist/diracx*.whl
131
64
retention-days : 5
132
- - name : Make release on GitHub
133
- if : steps.check-tag.outputs.create-release == 'true'
134
- run : |
135
- set -e
136
- export NEW_VERSION=${{ steps.check-tag.outputs.new-version }}
137
- REFERENCE_BRANCH=${GITHUB_REF##refs*(/heads)/}
138
- echo "Pushing tagged release notes to ${REFERENCE_BRANCH}"
139
- git push "origin" "${REFERENCE_BRANCH}"
140
- echo "Making GitHub release for ${NEW_VERSION}"
141
- .github/workflows/make_release.py \
142
- --repo="${{ github.repository }}" \
143
- --token="${{ secrets.GITHUB_TOKEN }}" \
144
- --version="${NEW_VERSION}" \
145
- --rev="$(git rev-parse HEAD)" \
146
- --release-notes-fn="release.notes.new"
147
- # Use trusted publisher for pypi
148
- # https://docs.pypi.org/trusted-publishers/
149
- - name : Publish package on PyPI
150
- if : steps.check-tag.outputs.create-release == 'true'
151
- uses : pypa/gh-action-pypi-publish@release/v1
152
-
153
- docker :
154
- needs : deploy-pypi
155
- timeout-minutes : 30
156
- runs-on : ubuntu-latest
157
- steps :
158
- - name : Checkout
159
- uses : actions/checkout@v4
160
- - name : Set up QEMU
161
- uses : docker/setup-qemu-action@v3
162
- - name : Set up Docker Buildx
163
- uses : docker/setup-buildx-action@v3
164
- - name : Login to GitHub container registry
165
- uses : docker/login-action@v3
166
- with :
167
- registry : ghcr.io
168
- username : ${{ github.actor }}
169
- password : ${{ secrets.GITHUB_TOKEN }}
170
- - name : Download diracx wheels
171
- uses : actions/download-artifact@v4
172
- with :
173
- name : diracx-whl
174
- - name : " Find wheels"
175
- id : find_wheel
176
- run : |
177
- # We need to copy them there to be able to access them in the RUN --mount
178
- cp diracx*.whl containers/client/
179
- cp diracx*.whl containers/services/
180
- for wheel_fn in *.whl; do
181
- pkg_name=$(basename "${wheel_fn}" | cut -d '-' -f 1)
182
- echo "${pkg_name}-wheel-name=$(ls "${pkg_name}"-*.whl)" >> $GITHUB_OUTPUT
183
- done
184
-
185
- - name : Build and push client (release)
186
- uses : docker/build-push-action@v6
187
- if : ${{ needs.deploy-pypi.outputs.create-release == 'true' }}
188
- with :
189
- context : containers/client/
190
- push : ${{ needs.deploy-pypi.outputs.create-release == 'true' }}
191
- tags : " ghcr.io/diracgrid/diracx/client:${{ needs.deploy-pypi.outputs.new-version }}"
192
- platforms : linux/amd64,linux/arm64
193
- build-args : EXTRA_PACKAGES_TO_INSTALL=DIRAC~=9.0.0a1
194
- - name : Build and push services (release)
195
- uses : docker/build-push-action@v6
196
- if : ${{ needs.deploy-pypi.outputs.create-release == 'true' }}
197
- with :
198
- context : containers/services/
199
- push : ${{ needs.deploy-pypi.outputs.create-release == 'true' }}
200
- tags : " ghcr.io/diracgrid/diracx/services:${{ needs.deploy-pypi.outputs.new-version }}"
201
- platforms : linux/amd64,linux/arm64
202
- build-args : EXTRA_PACKAGES_TO_INSTALL=DIRAC~=9.0.0a1
203
-
204
- - name : Build and push client (dev)
205
- uses : docker/build-push-action@v6
206
- with :
207
- context : containers/client/
208
- push : ${{ github.event_name != 'pull_request' && github.repository == 'DIRACGrid/diracx' && github.ref_name == 'main' }}
209
- tags : ghcr.io/diracgrid/diracx/client:dev
210
- platforms : linux/amd64,linux/arm64
211
- build-args : |
212
- EXTRA_PACKAGES_TO_INSTALL=git+https://github.com/DIRACGrid/DIRAC.git@integration
213
- - name : Build and push services (dev)
214
- uses : docker/build-push-action@v6
215
- with :
216
- context : containers/services/
217
- push : ${{ github.event_name != 'pull_request' && github.repository == 'DIRACGrid/diracx' && github.ref_name == 'main' }}
218
- tags : ghcr.io/diracgrid/diracx/services:dev
219
- platforms : linux/amd64,linux/arm64
220
- build-args : |
221
- EXTRA_PACKAGES_TO_INSTALL=git+https://github.com/DIRACGrid/DIRAC.git@integration
222
65
223
66
# -------------------------------------------------------------------------------------------------
224
67
# Gubbins deployment
@@ -313,14 +156,14 @@ jobs:
313
156
with :
314
157
context : extensions/containers/client
315
158
push : ${{ needs.deploy-pypi.outputs.create-release == 'true' }}
316
- tags : ghcr.io/diracgrid /gubbins/client:dev
159
+ tags : ghcr.io/aldbr /gubbins/client:dev
317
160
platforms : linux/amd64,linux/arm64
318
161
- name : Build and push service (dev)
319
162
uses : docker/build-push-action@v6
320
163
with :
321
164
context : extensions/containers/services
322
165
push : ${{ needs.deploy-pypi.outputs.create-release == 'true' }}
323
- tags : ghcr.io/diracgrid /gubbins/services:dev
166
+ tags : ghcr.io/aldbr /gubbins/services:dev
324
167
platforms : linux/amd64,linux/arm64
325
168
build-args : |
326
169
EXTRA_PACKAGES_TO_INSTALL=git+https://github.com/DIRACGrid/DIRAC.git@integration
0 commit comments