Skip to content

Commit c6a3b14

Browse files
ci: adjust the release process to handle publishing ops and ops-scenario (#1432)
Adds new publish workflows for ops-scenario (one for main PyPI, one for test.pypi.org), modelled on the ops workflows. These differ significantly from the old ops-scenario publish workflow (now deleted), which would automatically create a GitHub release and tag and publish to PyPI (with API credentials) on a push to main. To avoid confusion, the publish workflows for `ops` are renamed (and while this is being done, the extension is changed from `yml` to `yaml` to match all the other files). The publish workflows are trigged by new tags - `2.*` for `ops` (rather than a release being published) and `scenario-7.*` for `ops-scenario`. This allows releases that only include publishing one of the packages (for example, in a month that had no changes to one, or when a patch release is required). The HACKING.md documentation is updated to reflect the changes in the release process. A CHANGES.md is added for Scenario, backdated to 7.0.0 (although 7.0.0 is not entirely complete, but it does list the main changes). Once this is merged, trusted publishing will need to be configured for the `ops-scenario` package, and the config for `ops` will need to be adjusted to refer to the new workflow filename. Drive-bys: * The smoke test workflow had incorrect indentation for the `schedule` trigger. * Clarify when `(testing)` and `(harness)` scopes are used in conventional commits, now that we have Scenario in the repo. * Note the use of the various `.. juju` directives in documentation. * Minor clarifications in the release process based on comments from @james-garner-canonical when he did his first release.
1 parent 6a17bf9 commit c6a3b14

8 files changed

+290
-114
lines changed

.github/workflows/build_scenario_wheels.yaml

-61
This file was deleted.

.github/workflows/publish.yml .github/workflows/publish-ops-scenario.yaml

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Publish
22
on:
3-
release:
4-
types:
5-
- published
3+
push:
4+
tags:
5+
- 'scenario-7.*'
66

77
jobs:
88
framework-tests:
@@ -12,7 +12,7 @@ jobs:
1212
hello-charm-tests:
1313
uses: ./.github/workflows/hello-charm-tests.yaml
1414
build-n-publish:
15-
name: Build and Publish to PyPI
15+
name: Build and Publish ops-scenario to PyPI
1616
runs-on: ubuntu-latest
1717
permissions:
1818
id-token: write
@@ -27,9 +27,10 @@ jobs:
2727
run: pip install wheel build
2828
- name: Build
2929
run: python -m build
30+
working-directory: ./testing
3031
- name: Attest build provenance
3132
uses: actions/[email protected]
3233
with:
33-
subject-path: 'dist/*'
34+
subject-path: 'testing/dist/*'
3435
- name: Publish
3536
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/publish-ops.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish
2+
on:
3+
push:
4+
tags:
5+
# TODO: When we come to ops v3.x we will need to reconsider what to do
6+
# here (we might want to start prefixing with 'v' for one thing), and we
7+
# will likely be publishing at least three packages: ops, ops-scenario,
8+
# and ops-harness.
9+
- '2.*'
10+
11+
jobs:
12+
framework-tests:
13+
uses: ./.github/workflows/framework-tests.yaml
14+
observability-charm-tests:
15+
uses: ./.github/workflows/observability-charm-tests.yaml
16+
hello-charm-tests:
17+
uses: ./.github/workflows/hello-charm-tests.yaml
18+
build-n-publish:
19+
name: Build and Publish ops to PyPI
20+
runs-on: ubuntu-latest
21+
permissions:
22+
id-token: write
23+
attestations: write
24+
contents: read
25+
needs: [framework-tests, observability-charm-tests, hello-charm-tests]
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Setup Python
29+
uses: actions/setup-python@v5
30+
- name: Install build dependencies
31+
run: pip install wheel build
32+
- name: Build
33+
run: python -m build
34+
- name: Attest build provenance
35+
uses: actions/[email protected]
36+
with:
37+
subject-path: 'dist/*'
38+
- name: Publish
39+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/smoke.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: ops Smoke Tests
22

33
on:
44
workflow_dispatch:
5-
schedule:
6-
- cron: '0 7 25 * *'
5+
schedule:
6+
- cron: '0 7 25 * *'
77

88
jobs:
99
test:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test Publish
2+
on: [workflow_dispatch, workflow_call]
3+
4+
jobs:
5+
framework-tests:
6+
uses: ./.github/workflows/framework-tests.yaml
7+
observability-charm-tests:
8+
uses: ./.github/workflows/observability-charm-tests.yaml
9+
hello-charm-tests:
10+
uses: ./.github/workflows/hello-charm-tests.yaml
11+
build-n-publish:
12+
name: Build and Publish ops-scenario to Test PyPI
13+
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write
16+
attestations: write
17+
contents: read
18+
needs: [framework-tests, observability-charm-tests, hello-charm-tests]
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Setup Python
22+
uses: actions/setup-python@v5
23+
- name: Install build dependencies
24+
run: pip install wheel build
25+
- name: Build
26+
run: python -m build
27+
working-directory: ./testing
28+
- name: Attest build provenance
29+
uses: actions/[email protected]
30+
with:
31+
subject-path: 'testing/dist/*'
32+
- name: Publish to test.pypi.org
33+
uses: pypa/gh-action-pypi-publish@release/v1
34+
with:
35+
repository-url: https://test.pypi.org/legacy/

.github/workflows/test-publish.yml .github/workflows/test-publish-ops.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
hello-charm-tests:
1010
uses: ./.github/workflows/hello-charm-tests.yaml
1111
build-n-publish:
12-
name: Build and Publish to Test PyPI
12+
name: Build and Publish ops to Test PyPI
1313
runs-on: ubuntu-latest
1414
permissions:
1515
id-token: write

0 commit comments

Comments
 (0)