|
2 | 2 |
|
3 | 3 | Reusable workflow that: |
4 | 4 |
|
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 |
6 | 6 | - verifies that a corresponding container image (tagged with the commit SHA) already exists |
7 | 7 |
|
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. |
9 | 9 |
|
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. |
11 | 11 |
|
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 |
17 | 13 |
|
| 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. | |
18 | 19 |
|
19 | 20 | ## Secrets |
20 | 21 |
|
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. |
22 | 23 |
|
23 | 24 | ## Usage |
24 | 25 |
|
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`: |
26 | 27 |
|
27 | 28 | ```yaml |
28 | 29 | jobs: |
| 30 | + release: |
| 31 | + uses: health-informatics-uon/workflows/.github/workflows/semantic-release.yml@main |
| 32 | + secrets: inherit |
| 33 | + |
29 | 34 | semver-container: |
| 35 | + needs: release |
| 36 | + if: needs.release.outputs.release-created == 'true' |
30 | 37 | uses: health-informatics-uon/workflows/.github/workflows/semver-container.yml@main |
31 | 38 | with: |
32 | 39 | image-name: my-service |
33 | | - registry: ghcr.io |
34 | | - release-name-prefix: 'My Service ' |
| 40 | + tag: ${{ needs.release.outputs.release-tag }} |
35 | 41 | secrets: inherit |
36 | 42 | ``` |
37 | 43 |
|
38 | 44 | This will: |
39 | 45 |
|
40 | 46 | - 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