Skip to content

Commit 3217ce6

Browse files
committed
Add docs
1 parent 6f8fa18 commit 3217ce6

2 files changed

Lines changed: 29 additions & 19 deletions

File tree

docs/semantic-release.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ Reusable workflow that runs [semantic-release](https://github.com/semantic-relea
1010

1111
## Outputs
1212

13-
| Output | Description |
14-
|-------------------|----------------------------------------------------------|
15-
| `release-created` | `'true'` if a new release was created, `'false'` if not. |
13+
| Output | Description |
14+
|-------------------|--------------------------------------------------------------------------|
15+
| `release-created` | `'true'` if a new release was created, `'false'` if not. |
16+
| `release-tag` | The tag created by semantic-release (e.g. `1.2.3`). Empty string if no release was created. |
1617

17-
Use this to conditionally run downstream jobs (e.g. re-tag a container, publish to PyPI) only when a release actually happened:
18+
Use these to conditionally run downstream jobs (e.g. re-tag a container, publish to PyPI) only when a release actually happened:
1819

1920
```yaml
2021
jobs:
@@ -25,7 +26,11 @@ jobs:
2526
publish:
2627
needs: release
2728
if: needs.release.outputs.release-created == 'true'
28-
...
29+
uses: health-informatics-uon/workflows/.github/workflows/semver-container.yml@main
30+
with:
31+
image-name: my-app
32+
tag: ${{ needs.release.outputs.release-tag }}
33+
secrets: inherit
2934
```
3035
3136
> **Note:** If the workflow itself errors, `release-created` will be an empty string rather than `'false'`. Always use `== 'true'` rather than `!= 'false'` in conditions.

docs/semver-container.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,46 @@
22

33
Reusable workflow that:
44

5-
- tags an existing container image with semver tags (`x.y.z`, `x`, `x.y`) based on the git tag
5+
- tags an existing container image with semver tags (`x.y.z`, `x`, `x.y`) based on a provided release tag
66
- verifies that a corresponding container image (tagged with the commit SHA) already exists
77

8-
Use this when you already have an \"edge\" or commit-SHA container image (for example from the `publish-container` workflow) and you want to promote it to a semver release.
8+
Use this when you already have an "edge" or commit-SHA container image (for example from the `publish-container` workflow) and you want to promote it to a semver release.
99

10-
## Inputs
10+
> **Note:** The `x` and `x.y` floating tags are only applied for stable releases. Pre-release versions (e.g. `1.0.0-beta.1`) receive only the full version tag.
1111
12-
| Input | Required | Default | Description |
13-
|---------------------|----------|------------------------------------|------------------------------------------------------------------|
14-
| `image-name` | Yes || Image name, e.g. `my-app` or `services/api`. |
15-
| `registry` | No | `'ghcr.io'` | Registry host. |
16-
| `release-name-prefix` | No | `''` | String prefixed to the Release title (e.g. project name + space).|
12+
## Inputs
1713

14+
| Input | Required | Default | Description |
15+
|--------------|----------|-------------|------------------------------------------------------|
16+
| `image-name` | Yes || Image name, e.g. `my-app` or `services/api`. |
17+
| `registry` | No | `'ghcr.io'` | Registry host. |
18+
| `tag` | Yes || The release tag to derive semver from (e.g. `1.2.3` or `v1.2.3`). Typically passed from the `release-tag` output of the `semantic-release` workflow. |
1819

1920
## Secrets
2021

21-
- `GITHUB_TOKEN` — Pass with `secrets: inherit` so the workflow can read tags, create releases, and push tags in the container registry.
22+
- `GITHUB_TOKEN` — Pass with `secrets: inherit` so the workflow can push tags in the container registry.
2223

2324
## Usage
2425

25-
This workflow is designed to as part of a release process.
26+
This workflow is designed to run as part of a release process, chained after `semantic-release`:
2627

2728
```yaml
2829
jobs:
30+
release:
31+
uses: health-informatics-uon/workflows/.github/workflows/semantic-release.yml@main
32+
secrets: inherit
33+
2934
semver-container:
35+
needs: release
36+
if: needs.release.outputs.release-created == 'true'
3037
uses: health-informatics-uon/workflows/.github/workflows/semver-container.yml@main
3138
with:
3239
image-name: my-service
33-
registry: ghcr.io
34-
release-name-prefix: 'My Service '
40+
tag: ${{ needs.release.outputs.release-tag }}
3541
secrets: inherit
3642
```
3743
3844
This will:
3945
4046
- check that an image `ghcr.io/<owner>/my-service:<sha>` exists
41-
- push additional tags like `1.2.3`, `1`, and `1.2` to that image
42-
47+
- push additional tags like `1.2.3`, `1`, and `1.2` to that image (or just `1.2.3` for pre-releases)

0 commit comments

Comments
 (0)