Debian Codegraph @

.github/workflows/ci-cd.yml

raw
1 ---
2
3 name: πŸ‘·tests
4
5 on: # yamllint disable-line rule:truthy
6 merge_group:
7 push:
8 branches-ignore:
9 - dependabot/**
10 - gh-readonly-queue/** # Temporary merge queue-related GH-made branches
11 - pre-commit-ci-update-config
12 pull_request:
13 schedule:
14 - cron: 1 0 * * * # Run daily at 0:01 UTC
15 workflow_dispatch:
16 inputs:
17 release-version:
18 # github.event_name == 'workflow_dispatch'
19 # && github.event.inputs.release-version
20 description: >-
21 Target PEP440-compliant version to release.
22 Please, don't prepend `v`.
23 type: string
24 required: true
25 release-committish:
26 # github.event_name == 'workflow_dispatch'
27 # && github.event.inputs.release-committish
28 default: ''
29 description: >-
30 The commit to be released to PyPI and tagged
31 in Git as `release-version`. Normally, you
32 should keep this empty.
33 type: string
34 required: false
35 YOLO:
36 default: false
37 description: >-
38 Set this flag to disregard the outcome of the
39 test stage. The test results will block the
40 release otherwise. Only use this under
41 extraordinary circumstances to ignore the test
42 failures and cut the release regardless.
43 type: boolean
44 required: false
45
46 concurrency:
47 group: >-
48 ${{
49 github.workflow
50 }}-${{
51 github.ref_type
52 }}-${{
53 github.event.pull_request.number || github.sha
54 }}
55 cancel-in-progress: true
56
57 env:
58 FORCE_COLOR: 1 # Request colored output from CLI tools supporting it
59 MYPY_FORCE_COLOR: 1 # MyPy's color enforcement
60 PIP_DISABLE_PIP_VERSION_CHECK: 1 # Hide "there's a newer pip" message
61 PIP_NO_PYTHON_VERSION_WARNING: 1 # Hide "this Python is deprecated" message
62 PIP_NO_WARN_SCRIPT_LOCATION: 1 # Hide "script dir is not in $PATH" message
63 PRE_COMMIT_COLOR: 1
64 PY_COLORS: 1 # Recognized by the `py` package, dependency of `pytest`
65 PYTHONIOENCODING: utf-8
66 PYTHONLEGACYWINDOWSSTDIO: 1 # Python 3.6 hack
67 PYTHONUTF8: 1
68 TOX_PARALLEL_NO_SPINNER: 1 # Disable tox's parallel run spinner animation
69 TOX_TESTENV_PASSENV: >-
70 FORCE_COLOR
71 MYPY_FORCE_COLOR
72 NO_COLOR
73 PY_COLORS
74 PYTEST_THEME
75 PYTEST_THEME_MODE
76
77 jobs:
78 pre-setup:
79 name: βš™οΈ Pre-set global build settings
80 runs-on: ubuntu-latest
81 defaults:
82 run:
83 shell: python
84 outputs:
85 dist-version: >-
86 ${{
87 steps.request-check.outputs.release-requested == 'true'
88 && github.event.inputs.release-version
89 || steps.scm-version.outputs.dist-version
90 }}
91 is-untagged-devel: >-
92 ${{ steps.untagged-check.outputs.is-untagged-devel || false }}
93 release-requested: >-
94 ${{
95 steps.request-check.outputs.release-requested || false
96 }}
97 is-yolo-mode: >-
98 ${{
99 (
100 steps.request-check.outputs.release-requested == 'true'
101 && github.event.inputs.YOLO
102 )
103 && true || false
104 }}
105 cache-key-files: >-
106 ${{ steps.calc-cache-key-files.outputs.files-hash-key }}
107 git-tag: ${{ steps.git-tag.outputs.tag }}
108 sdist-artifact-name: ${{ steps.artifact-name.outputs.sdist }}
109 wheel-artifact-name: ${{ steps.artifact-name.outputs.wheel }}
110 steps:
111 - name: Switch to using Python v3.11 by default
112 uses: actions/setup-python@v4
113 with:
114 python-version: 3.11
115 - name: >-
116 Mark the build as untagged '${{
117 github.event.repository.default_branch
118 }}' branch build
119 id: untagged-check
120 if: >-
121 github.event_name == 'push' &&
122 github.ref == format(
123 'refs/heads/{0}', github.event.repository.default_branch
124 )
125 run: |
126 from os import environ
127 from pathlib import Path
128
129 FILE_APPEND_MODE = 'a'
130
131 with Path(environ['GITHUB_OUTPUT']).open(
132 mode=FILE_APPEND_MODE,
133 ) as outputs_file:
134 print('is-untagged-devel=true', file=outputs_file)
135 - name: Mark the build as "release request"
136 id: request-check
137 if: github.event_name == 'workflow_dispatch'
138 run: |
139 from os import environ
140 from pathlib import Path
141
142 FILE_APPEND_MODE = 'a'
143
144 with Path(environ['GITHUB_OUTPUT']).open(
145 mode=FILE_APPEND_MODE,
146 ) as outputs_file:
147 print('release-requested=true', file=outputs_file)
148 - name: Check out src from Git
149 if: >-
150 steps.request-check.outputs.release-requested != 'true'
151 uses: actions/checkout@v3
152 with:
153 fetch-depth: 0
154 ref: ${{ github.event.inputs.release-committish }}
155 - name: >-
156 Calculate Python interpreter version hash value
157 for use in the cache key
158 if: >-
159 steps.request-check.outputs.release-requested != 'true'
160 id: calc-cache-key-py
161 run: |
162 from hashlib import sha512
163 from os import environ
164 from pathlib import Path
165 from sys import version
166
167 FILE_APPEND_MODE = 'a'
168
169 hash = sha512(version.encode()).hexdigest()
170
171 with Path(environ['GITHUB_OUTPUT']).open(
172 mode=FILE_APPEND_MODE,
173 ) as outputs_file:
174 print(f'py-hash-key={hash}', file=outputs_file)
175 - name: >-
176 Calculate dependency files' combined hash value
177 for use in the cache key
178 if: >-
179 steps.request-check.outputs.release-requested != 'true'
180 id: calc-cache-key-files
181 run: |
182 from os import environ
183 from pathlib import Path
184
185 FILE_APPEND_MODE = 'a'
186
187 with Path(environ['GITHUB_OUTPUT']).open(
188 mode=FILE_APPEND_MODE,
189 ) as outputs_file:
190 print(
191 "files-hash-key=${{
192 hashFiles(
193 'setup.cfg', 'setup.py', 'tox.ini', 'pyproject.toml',
194 '.pre-commit-config.yaml', 'pytest.ini'
195 )
196 }}",
197 file=outputs_file,
198 )
199 - name: Get pip cache dir
200 id: pip-cache-dir
201 if: >-
202 steps.request-check.outputs.release-requested != 'true'
203 run: >-
204 echo "dir=$(python -m pip cache dir)" >> "${GITHUB_OUTPUT}"
205 shell: bash
206 - name: Set up pip cache
207 if: >-
208 steps.request-check.outputs.release-requested != 'true'
209 uses: actions/cache@v3
210 with:
211 path: ${{ steps.pip-cache-dir.outputs.dir }}
212 key: >-
213 ${{ runner.os }}-pip-${{
214 steps.calc-cache-key-py.outputs.py-hash-key }}-${{
215 steps.calc-cache-key-files.outputs.files-hash-key }}
216 restore-keys: |
217 ${{ runner.os }}-pip-${{
218 steps.calc-cache-key-py.outputs.py-hash-key
219 }}-
220 ${{ runner.os }}-pip-
221 ${{ runner.os }}-
222 - name: Drop Git tags from HEAD for non-release requests
223 if: >-
224 steps.request-check.outputs.release-requested != 'true'
225 run: >-
226 git tag --points-at HEAD
227 |
228 xargs git tag --delete
229 shell: bash
230 - name: Set up versioning prerequisites
231 if: >-
232 steps.request-check.outputs.release-requested != 'true'
233 run: >-
234 python -m
235 pip install
236 --user
237 setuptools-scm
238 shell: bash
239 - name: Set the current dist version from Git
240 if: steps.request-check.outputs.release-requested != 'true'
241 id: scm-version
242 run: |
243 from os import environ
244 from pathlib import Path
245
246 import setuptools_scm
247
248 FILE_APPEND_MODE = 'a'
249
250 ver = setuptools_scm.get_version(
251 ${{
252 steps.untagged-check.outputs.is-untagged-devel == 'true'
253 && 'local_scheme="no-local-version"' || ''
254 }}
255 )
256 with Path(environ['GITHUB_OUTPUT']).open(
257 mode=FILE_APPEND_MODE,
258 ) as outputs_file:
259 print(f'dist-version={ver}', file=outputs_file)
260 - name: Set the target Git tag
261 id: git-tag
262 run: |
263 from os import environ
264 from pathlib import Path
265
266 FILE_APPEND_MODE = 'a'
267
268 with Path(environ['GITHUB_OUTPUT']).open(
269 mode=FILE_APPEND_MODE,
270 ) as outputs_file:
271 print(
272 "tag=v${{
273 steps.request-check.outputs.release-requested == 'true'
274 && github.event.inputs.release-version
275 || steps.scm-version.outputs.dist-version
276 }}",
277 file=outputs_file,
278 )
279 - name: Set the expected dist artifact names
280 id: artifact-name
281 run: |
282 from os import environ
283 from pathlib import Path
284
285 FILE_APPEND_MODE = 'a'
286
287 with Path(environ['GITHUB_OUTPUT']).open(
288 mode=FILE_APPEND_MODE,
289 ) as outputs_file:
290 print(
291 "sdist=sphinxcontrib-towncrier-${{
292 steps.request-check.outputs.release-requested == 'true'
293 && github.event.inputs.release-version
294 || steps.scm-version.outputs.dist-version
295 }}.tar.gz",
296 file=outputs_file,
297 )
298 print(
299 "wheel=sphinxcontrib_towncrier-${{
300 steps.request-check.outputs.release-requested == 'true'
301 && github.event.inputs.release-version
302 || steps.scm-version.outputs.dist-version
303 }}-py3-none-any.whl",
304 file=outputs_file,
305 )
306
307 build:
308 name: >-
309 πŸ‘· dists ${{ needs.pre-setup.outputs.git-tag }}
310 [mode: ${{
311 fromJSON(needs.pre-setup.outputs.is-untagged-devel)
312 && 'nightly' || ''
313 }}${{
314 fromJSON(needs.pre-setup.outputs.release-requested)
315 && 'release' || ''
316 }}${{
317 (
318 !fromJSON(needs.pre-setup.outputs.is-untagged-devel)
319 && !fromJSON(needs.pre-setup.outputs.release-requested)
320 ) && 'test' || ''
321 }}]
322 needs:
323 - pre-setup
324
325 runs-on: ubuntu-latest
326
327 env:
328 TOXENV: build-dists
329
330 steps:
331 - name: Switch to using Python v3.11
332 uses: actions/setup-python@v4
333 with:
334 python-version: 3.11
335
336 - name: Grab the source from Git
337 uses: actions/checkout@v3
338 with:
339 fetch-depth: >-
340 ${{
341 fromJSON(needs.pre-setup.outputs.release-requested)
342 && 1 || 0
343 }}
344 ref: ${{ github.event.inputs.release-committish }}
345
346 - name: >-
347 Calculate Python interpreter version hash value
348 for use in the cache key
349 id: calc-cache-key-py
350 run: |
351 from hashlib import sha512
352 from os import environ
353 from pathlib import Path
354 from sys import version
355
356 FILE_APPEND_MODE = 'a'
357
358 hash = sha512(version.encode()).hexdigest()
359
360 with Path(environ['GITHUB_OUTPUT']).open(
361 mode=FILE_APPEND_MODE,
362 ) as outputs_file:
363 print(f'py-hash-key={hash}', file=outputs_file)
364 shell: python
365 - name: Get pip cache dir
366 id: pip-cache-dir
367 run: >-
368 echo "dir=$(python -m pip cache dir)" >> "${GITHUB_OUTPUT}"
369 - name: Set up pip cache
370 uses: actions/cache@v3
371 with:
372 path: ${{ steps.pip-cache-dir.outputs.dir }}
373 key: >-
374 ${{ runner.os }}-pip-${{
375 steps.calc-cache-key-py.outputs.py-hash-key }}-${{
376 needs.pre-setup.outputs.cache-key-files }}
377 restore-keys: |
378 ${{ runner.os }}-pip-${{
379 steps.calc-cache-key-py.outputs.py-hash-key
380 }}-
381 ${{ runner.os }}-pip-
382 - name: Install tox
383 run: >-
384 python -m
385 pip install
386 --user
387 tox
388
389 - name: Pre-populate the tox env
390 run: >-
391 python -m
392 tox
393 --parallel auto
394 --parallel-live
395 --skip-missing-interpreters false
396 --notest
397
398 - name: Drop Git tags from HEAD for non-tag-create events
399 if: >-
400 !fromJSON(needs.pre-setup.outputs.release-requested)
401 run: >-
402 git tag --points-at HEAD
403 |
404 xargs git tag --delete
405 shell: bash
406
407 - name: Setup git user as [bot]
408 if: >-
409 fromJSON(needs.pre-setup.outputs.release-requested)
410 || fromJSON(needs.pre-setup.outputs.is-untagged-devel)
411 uses: fregante/setup-git-user@v2
412 - name: >-
413 Tag the release in the local Git repo
414 as ${{ needs.pre-setup.outputs.git-tag }}
415 for setuptools-scm to set the desired version
416 if: >-
417 fromJSON(needs.pre-setup.outputs.is-untagged-devel)
418 || fromJSON(needs.pre-setup.outputs.release-requested)
419 run: >-
420 git tag
421 -m '${{ needs.pre-setup.outputs.git-tag }}'
422 '${{ needs.pre-setup.outputs.git-tag }}'
423 --
424 ${{ github.event.inputs.release-committish }}
425
426 - name: Build dists
427 run: >-
428 python -m
429 tox
430 --parallel auto
431 --parallel-live
432 --skip-missing-interpreters false
433 --skip-pkg-install
434 - name: Verify that the artifacts with expected names got created
435 run: >-
436 ls -1
437 'dist/${{ needs.pre-setup.outputs.sdist-artifact-name }}'
438 'dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}'
439 - name: Store the distribution packages
440 uses: actions/upload-artifact@v3
441 with:
442 name: python-package-distributions
443 # NOTE: Exact expected file names are specified here
444 # NOTE: as a safety measure β€” if anything weird ends
445 # NOTE: up being in this dir or not all dists will be
446 # NOTE: produced, this will fail the workflow.
447 path: |
448 dist/${{ needs.pre-setup.outputs.sdist-artifact-name }}
449 dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}
450 retention-days: >-
451 ${{
452 (
453 fromJSON(needs.pre-setup.outputs.release-requested)
454 ) && 90 || 30
455 }}
456
457 lint:
458 uses: ./.github/workflows/reusable-linters.yml
459
460 tests:
461 name: >-
462 πŸ“${{ matrix.towncrier-version }}
463 /
464 🐍${{ matrix.python-version }}
465 /
466 πŸ’»${{ matrix.os }}
467
468 needs:
469 - build
470 - pre-setup # transitive, for accessing settings
471
472 runs-on: ${{ matrix.os }}
473 strategy:
474 matrix:
475 towncrier-version:
476 - 23.10.0rc1
477 - 23.6.0
478 - 22.12.0rc1
479 - 22.8.0
480 - 21.9.0rc1
481 - 21.3.0
482 - 19.9.0
483 - 19.2.0
484 python-version:
485 - ~3.12.0-0
486 - 3.11
487 - >-
488 3.10
489 - 3.9
490 - 3.8
491 - 3.7
492 - 3.6
493 os:
494 - ubuntu-22.04
495 - ubuntu-20.04
496 - macos-12
497 - macos-11
498 - windows-latest
499 exclude:
500 - os: ubuntu-22.04
501 python-version: 3.6 # EOL, only provided for older OSs
502 - python-version: 3.6
503 towncrier-version: 22.8.0 # Dropped support for Python 3.6
504 - python-version: 3.6
505 towncrier-version: 22.12.0rc1 # Does not support Python 3.6
506 - python-version: 3.6
507 towncrier-version: 23.6.0 # Dropped support for Python 3.6
508 - python-version: 3.6
509 towncrier-version: 23.10.0rc1 # Does not support Python 3.6
510 - python-version: 3.7
511 towncrier-version: 23.10.0rc1 # Dropped support for Python 3.7
512 - python-version: ~3.12.0-0
513 towncrier-version: 19.2.0 # Does not support Python 3.12
514 - python-version: ~3.12.0-0
515 towncrier-version: 19.9.0 # Does not support Python 3.12
516 - python-version: ~3.12.0-0
517 towncrier-version: 21.3.0 # Does not support Python 3.12
518
519 continue-on-error: >-
520 ${{
521 (
522 fromJSON(needs.pre-setup.outputs.is-yolo-mode)
523 ) && true || false
524 }}
525
526 env:
527 TOXENV: python
528
529 steps:
530 - name: Grab the source from Git
531 uses: actions/checkout@v3
532 with:
533 ref: ${{ github.event.inputs.release-committish }}
534
535 - name: Download all the dists
536 uses: actions/download-artifact@v3
537 with:
538 name: python-package-distributions
539 path: dist/
540
541 - name: Set up Python ${{ matrix.python-version }}
542 id: python-install
543 uses: actions/setup-python@v4
544 with:
545 python-version: ${{ matrix.python-version }}
546 - name: >-
547 Calculate Python interpreter version hash value
548 for use in the cache key
549 id: calc-cache-key-py
550 run: |
551 from hashlib import sha512
552 from os import environ
553 from pathlib import Path
554 from sys import version
555
556 FILE_APPEND_MODE = 'a'
557
558 hash = sha512(version.encode()).hexdigest()
559
560 with Path(environ['GITHUB_OUTPUT']).open(
561 mode=FILE_APPEND_MODE,
562 ) as outputs_file:
563 print(f'py-hash-key={hash}', file=outputs_file)
564 shell: python
565 - name: Set up pip cache
566 uses: actions/cache@v3
567 with:
568 path: ~/.cache/pip
569 key: >-
570 ${{ runner.os }}-pip-${{
571 steps.calc-cache-key-py.outputs.py-hash-key }}-${{
572 hashFiles('setup.cfg') }}-${{
573 hashFiles('tox.ini') }}-${{
574 hashFiles('pyproject.toml') }}-${{
575 hashFiles('.pre-commit-config.yaml') }}
576 restore-keys: |
577 ${{ runner.os }}-pip-${{
578 steps.calc-cache-key-py.outputs.py-hash-key
579 }}-
580 ${{ runner.os }}-pip-
581 ${{ runner.os }}-
582 - name: Install tox
583 # NOTE: Tox4 does not work correctly in our CI under Windows. Limiting the
584 # NOTE: version is a workaround to be used until it's fixed.
585 # Ref: https://github.com/tox-dev/tox/issues/2692
586 run: >-
587 python -m
588 pip install
589 --user
590 "tox${{ runner.os == 'Windows' && ' < 4' || '' }}"
591 - name: Log installed dists
592 run: |
593 python -m pip freeze --all
594
595 - name: Patch tox.ini for Python 3.6 under Windows
596 if: >-
597 runner.os == 'Windows'
598 && matrix.python-version == '3.6'
599 run: >-
600 sed -i
601 's/^package_env\(\s\)\?=.*/package_env = py36-win-dummy/g'
602 tox.ini
603 shell: bash
604
605 - name: Initialize tox envs
606 run: >-
607 python
608 -m tox
609 --parallel auto
610 --parallel-live
611 --skip-missing-interpreters false
612 --installpkg 'dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}'
613 --force-dep 'towncrier ~= ${{ matrix.towncrier-version }}'
614 --notest
615 - name: Test with tox
616 run: >-
617 python
618 -m tox
619 --parallel auto
620 --parallel-live
621 --skip-missing-interpreters false
622 --installpkg 'dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}'
623 --force-dep 'towncrier ~= ${{ matrix.towncrier-version }}'
624 - name: Send coverage data to Codecov
625 uses: codecov/codecov-action@v3
626 with:
627 files: .test-results/pytest/cov.xml
628 flags: >-
629 CI-GHA,
630 OS-${{
631 runner.os
632 }},
633 VM-${{
634 matrix.os
635 }},
636 Py-${{
637 steps.python-install.outputs.python-version
638 }},
639 Towncrier-v${{
640 matrix.towncrier-version
641 }}
642
643 check: # This job does nothing and is only used for the branch protection
644 if: always()
645
646 needs:
647 - lint
648 - pre-setup # transitive, for accessing settings
649 - tests
650
651 runs-on: ubuntu-latest
652
653 steps:
654 - name: Decide whether the needed jobs succeeded or failed
655 uses: re-actors/alls-green@release/v1
656 with:
657 allowed-failures: >-
658 ${{
659 fromJSON(needs.pre-setup.outputs.is-yolo-mode)
660 && 'lint, tests' || ''
661 }}
662 jobs: ${{ toJSON(needs) }}
663
664 publish-pypi:
665 name: Publish πŸπŸ“¦ ${{ needs.pre-setup.outputs.git-tag }} to PyPI
666 needs:
667 - check
668 - pre-setup # transitive, for accessing settings
669 if: >-
670 fromJSON(needs.pre-setup.outputs.release-requested)
671 runs-on: ubuntu-latest
672
673 permissions:
674 id-token: write # IMPORTANT: mandatory for trusted publishing
675
676 environment:
677 name: pypi
678 url: >-
679 https://pypi.org/project/sphinxcontrib-towncrier/${{
680 needs.pre-setup.outputs.dist-version
681 }}
682
683 steps:
684 - name: Download all the dists
685 uses: actions/download-artifact@v3
686 with:
687 name: python-package-distributions
688 path: dist/
689 - name: >-
690 Publish πŸπŸ“¦ ${{ needs.pre-setup.outputs.git-tag }} to PyPI
691 uses: pypa/gh-action-pypi-publish@release/v1
692
693 publish-testpypi:
694 name: Publish πŸπŸ“¦ ${{ needs.pre-setup.outputs.git-tag }} to TestPyPI
695 needs:
696 - check
697 - pre-setup # transitive, for accessing settings
698 if: >-
699 fromJSON(needs.pre-setup.outputs.is-untagged-devel)
700 || fromJSON(needs.pre-setup.outputs.release-requested)
701 runs-on: ubuntu-latest
702
703 permissions:
704 id-token: write # IMPORTANT: mandatory for trusted publishing
705
706 environment:
707 name: testpypi
708 url: >-
709 https://test.pypi.org/project/sphinxcontrib-towncrier/${{
710 needs.pre-setup.outputs.dist-version
711 }}
712
713 steps:
714 - name: Download all the dists
715 uses: actions/download-artifact@v3
716 with:
717 name: python-package-distributions
718 path: dist/
719 - name: >-
720 Publish πŸπŸ“¦ ${{ needs.pre-setup.outputs.git-tag }} to TestPyPI
721 uses: pypa/gh-action-pypi-publish@release/v1
722 with:
723 repository-url: https://test.pypi.org/legacy/
724
725 post-release-repo-update:
726 name: >-
727 Publish post-release Git tag
728 for ${{ needs.pre-setup.outputs.git-tag }}
729 needs:
730 - publish-pypi
731 - pre-setup # transitive, for accessing settings
732 runs-on: ubuntu-latest
733
734 steps:
735 - name: >-
736 Check if the requested tag ${{ needs.pre-setup.outputs.git-tag }}
737 is present and is pointing at the required commit ${{
738 github.event.inputs.release-committish
739 }}
740 id: existing-remote-tag-check
741 run: |
742 REMOTE_TAGGED_COMMIT_SHA="$(
743 git ls-remote --tags --refs $(git remote get-url origin) '${{
744 needs.pre-setup.outputs.git-tag
745 }}' | awk '{print $1}'
746 )"
747
748 if [[ "${REMOTE_TAGGED_COMMIT_SHA}" == '${{
749 github.event.inputs.release-committish
750 }}' ]]
751 then
752 echo "already-exists=true" >> "${GITHUB_OUTPUT}"
753 fi
754
755 - name: Fetch the src snapshot
756 if: steps.existing-remote-tag-check.outputs.already-exists == 'true'
757 uses: actions/checkout@v3
758 with:
759 fetch-depth: 1
760 ref: ${{ github.event.inputs.release-committish }}
761 - name: Setup git user as [bot]
762 if: steps.existing-remote-tag-check.outputs.already-exists == 'true'
763 uses: fregante/setup-git-user@v2
764 - name: >-
765 Tag the release in the local Git repo
766 as ${{ needs.pre-setup.outputs.git-tag }}
767 if: steps.existing-remote-tag-check.outputs.already-exists == 'true'
768 run: >-
769 git tag
770 -m '${{ needs.pre-setup.outputs.git-tag }}'
771 -m 'Published at https://pypi.org/project/sphinxcontrib-towncrier/${{
772 needs.pre-setup.outputs.dist-version
773 }}'
774 -m 'This release has been produced by the following workflow run: ${{
775 github.server_url
776 }}/${{
777 github.repository
778 }}/actions/runs/${{
779 github.run_id
780 }}'
781 '${{ needs.pre-setup.outputs.git-tag }}'
782 --
783 ${{ github.event.inputs.release-committish }}
784 - name: >-
785 Push ${{ needs.pre-setup.outputs.git-tag }} tag corresponding
786 to the just published release back to GitHub
787 if: steps.existing-remote-tag-check.outputs.already-exists == 'true'
788 run: >-
789 git push --atomic origin '${{ needs.pre-setup.outputs.git-tag }}'
790
791 publish-github-release:
792 name: >-
793 Publish a GitHub Release for
794 ${{ needs.pre-setup.outputs.git-tag }}
795 needs:
796 - post-release-repo-update
797 - pre-setup # transitive, for accessing settings
798 runs-on: ubuntu-latest
799
800 permissions:
801 contents: write
802 discussions: write
803 id-token: write # IMPORTANT: mandatory for Sigstore signing
804
805 steps:
806 - name: Download all the dists
807 uses: actions/download-artifact@v3
808 with:
809 name: python-package-distributions
810 path: dist/
811
812 - name: Sign the dists with Sigstore
813 uses: sigstore/[email protected]
814 with:
815 inputs: >-
816 dist/${{ needs.pre-setup.outputs.sdist-artifact-name }}
817 dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}
818
819 - name: >-
820 Publish a GitHub Release for
821 ${{ needs.pre-setup.outputs.git-tag }}
822 with Sigstore-signed artifacts
823 uses: ncipollo/[email protected]
824 with:
825 allowUpdates: false
826 artifactErrorsFailBuild: false
827 artifacts: |
828 dist/${{ needs.pre-setup.outputs.sdist-artifact-name }}
829 dist/${{ needs.pre-setup.outputs.sdist-artifact-name }}.crt
830 dist/${{ needs.pre-setup.outputs.sdist-artifact-name }}.sig
831 dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}
832 dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}.crt
833 dist/${{ needs.pre-setup.outputs.wheel-artifact-name }}.sig
834 artifactContentType: raw # Because whl and tgz are of different types
835 body: >
836 # Release ${{ needs.pre-setup.outputs.git-tag }}
837
838
839 This release is published to
840 https://pypi.org/project/sphinxcontrib-towncrier/${{
841 needs.pre-setup.outputs.dist-version
842 }}.
843
844
845 This release has been produced by the following workflow run: ${{
846 github.server_url
847 }}/${{
848 github.repository
849 }}/actions/runs/${{
850 github.run_id
851 }}.
852 # bodyFile: # FIXME: Use once Towncrier is integrated.
853 commit: ${{ github.event.inputs.release-committish }}
854 discussionCategory: Announcements
855 draft: false
856 name: ${{ needs.pre-setup.outputs.git-tag }}
857 # omitBody: false
858 omitBodyDuringUpdate: true
859 omitName: false
860 omitNameDuringUpdate: true
861 omitPrereleaseDuringUpdate: true
862 prerelease: false
863 removeArtifacts: false
864 replacesArtifacts: false
865 tag: ${{ needs.pre-setup.outputs.git-tag }}
866 token: ${{ secrets.GITHUB_TOKEN }}
867
868 ...