Debian Codegraph @

.github/workflows/2_auto_publish_release.yml

raw
1 name: Release stage 2 - auto publish
2
3 on:
4 pull_request: # types AND paths
5 types: [closed]
6 paths: ['cylc/flow/__init__.py']
7 # NOTE: While this is too generic, we use the `if` condition of the job to narrow it down
8 # NOTE: Don't use `branches` as we might create release on any branch
9
10 concurrency:
11 # Only let this run 1 at a time
12 group: ${{ github.workflow }}
13 cancel-in-progress: false
14
15 defaults:
16 run:
17 shell: bash
18
19 env:
20 FORCE_COLOR: 2
21 PIP_PROGRESS_BAR: off
22 # Best not to include the GH token here, only do it for the steps that need it
23 MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
24 CHANGELOG_FILE: CHANGES.md
25
26 jobs:
27 publish:
28 if: >- # NOTE: Can't use top-level env here unfortunately
29 github.event.pull_request.merged == true &&
30 contains(github.event.pull_request.labels.*.name, 'release')
31 runs-on: ubuntu-latest
32 timeout-minutes: 10
33 steps:
34
35 - name: Checkout repo
36 uses: actions/checkout@v5
37 with:
38 ref: ${{ env.MERGE_SHA }}
39
40 - name: Setup Python
41 uses: actions/setup-python@v6
42 with:
43 python-version: '3.x'
44
45 - name: Get the version number
46 uses: cylc/release-actions/stage-2/get-version-from-pr@v1
47
48 - name: Build
49 uses: cylc/release-actions/build-python-package@v1
50
51 - name: Publish distribution to PyPI
52 uses: pypa/gh-action-pypi-publish@release/v1
53 with:
54 user: __token__ # uses the API token feature of PyPI - least permissions possible
55 password: ${{ secrets.PYPI_TOKEN }}
56 # # Can try using this for testing:
57 # repository_url: https://test.pypi.org/legacy/
58
59 - name: Publish GitHub release
60 id: create-release
61 uses: cylc/release-actions/create-release@v1
62 env:
63 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64 with:
65 commitish: ${{ env.MERGE_SHA }}
66 tag_name: ${{ env.VERSION }}
67 release_name: cylc-flow-${{ env.VERSION }}
68 prerelease: ${{ env.PRERELEASE }}
69 body: |
70 See [${{ env.CHANGELOG_FILE }}](https://github.com/${{ github.repository }}/blob/master/${{ env.CHANGELOG_FILE }}) for detail.
71
72 Cylc 8 can be installed via pypi or Conda - you don't need to download this release directly.
73 See the [installation](https://cylc.github.io/cylc-doc/latest/html/installation.html) section of the documentation.
74 # TODO: Get topmost changelog section somehow and use that as the body?
75
76 - name: Comment on the release PR with the results & next steps
77 if: always()
78 uses: cylc/release-actions/stage-2/comment-on-pr@v1
79 env:
80 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 with:
82 release-url: ${{ steps.create-release.outputs.html_url }}
83
84 - name: Bump dev version
85 uses: cylc/release-actions/stage-2/bump-dev-version@v1
86 env:
87 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88 with:
89 init-file: 'cylc/flow/__init__.py'