Skip to content

Commit 19e60d8

Browse files
authored
feat: add reusable release-please workflow (#1)
* feat: add reusable release-please workflow Provides .github/workflows/release-please-reusable.yml callable as opencoreemr/github-workflows-public/.github/workflows/release-please-reusable.yml@<ref>. Pins openCoreEMR/release-please-action@v5.0.0-oce.1, which bundles the annotated-tag schema option. Callers set "annotated-tag": true in their release-please-config.json to get annotated tags directly from the action, making the post-release "Convert to annotated tag" workaround unnecessary. Inputs: config-file, manifest-file, runs-on, checkout-fetch-depth. Optional token secret (falls back to caller's GITHUB_TOKEN). Outputs: releases_created, release_created, tag_name, version, paths_released so downstream caller jobs can gate on a release being created. Also adds an actionlint workflow. Assisted-by: Claude Code * refactor: use printf instead of escaped backticks in summary steps Per review feedback. printf with single-quoted format strings reads cleaner than backslash-escaped backticks inside double-quoted echo arguments. Includes a shellcheck-disable for SC2016 (false positive: printf interprets the format-string escapes itself). Assisted-by: Claude Code * chore: add README, dependabot, self-hosted release-please Initial repo scaffolding: - README.md describing the repo's purpose and workflow inputs/secrets - .github/dependabot.yml monitoring github-actions only (no other ecosystems present) - release-please configured in manifest mode with annotated-tag: true and release-type: simple. The release-please workflow calls this repo's own reusable workflow via uses: ./.github/workflows/release-please-reusable.yml, avoiding the bootstrap problem of needing a tag before the first release. Assisted-by: Claude Code * chore: drop v prefix from release tags Match the existing initial 0.0.0 tag and the prevailing convention in the OCE module/CLI repos this workflow will serve. Assisted-by: Claude Code
1 parent 16f264b commit 19e60d8

7 files changed

Lines changed: 220 additions & 0 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
labels:
8+
- dependencies
9+
- github-actions
10+
commit-message:
11+
prefix: deps
12+
include: scope

‎.github/workflows/actionlint.yml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: actionlint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- .github/workflows/**
9+
- .github/actions/**
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- .github/workflows/**
15+
- .github/actions/**
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
actionlint:
22+
name: Lint GitHub Actions workflows
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v6
28+
29+
- name: Run actionlint
30+
uses: rhysd/actionlint@v1.7.12
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Release Please (reusable)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
config-file:
7+
description: Path to release-please-config.json
8+
type: string
9+
default: release-please-config.json
10+
manifest-file:
11+
description: Path to .release-please-manifest.json
12+
type: string
13+
default: .release-please-manifest.json
14+
runs-on:
15+
description: Runner label for the job
16+
type: string
17+
default: ubuntu-latest
18+
checkout-fetch-depth:
19+
description: fetch-depth for actions/checkout
20+
type: number
21+
default: 0
22+
secrets:
23+
token:
24+
description: Token for checkout and release-please. Falls back to GITHUB_TOKEN.
25+
required: false
26+
outputs:
27+
releases_created:
28+
description: '"true" if any release was created'
29+
value: ${{ jobs.release-please.outputs.releases_created }}
30+
release_created:
31+
description: '"true" if a release was created (root package, manifest mode)'
32+
value: ${{ jobs.release-please.outputs.release_created }}
33+
tag_name:
34+
description: Tag name of the created release (root package)
35+
value: ${{ jobs.release-please.outputs.tag_name }}
36+
version:
37+
description: Version of the created release (root package)
38+
value: ${{ jobs.release-please.outputs.version }}
39+
paths_released:
40+
description: JSON array of package paths that were released
41+
value: ${{ jobs.release-please.outputs.paths_released }}
42+
43+
jobs:
44+
release-please:
45+
name: Release Please
46+
runs-on: ${{ inputs.runs-on }}
47+
permissions:
48+
contents: write
49+
pull-requests: write
50+
outputs:
51+
releases_created: ${{ steps.release.outputs.releases_created }}
52+
release_created: ${{ steps.release.outputs.release_created }}
53+
tag_name: ${{ steps.release.outputs.tag_name }}
54+
version: ${{ steps.release.outputs.version }}
55+
paths_released: ${{ steps.release.outputs.paths_released }}
56+
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v6
60+
with:
61+
fetch-depth: ${{ inputs.checkout-fetch-depth }}
62+
token: ${{ secrets.token || github.token }}
63+
64+
- name: Run Release Please
65+
id: release
66+
uses: openCoreEMR/release-please-action@v5.0.0-oce.1
67+
with:
68+
config-file: ${{ inputs.config-file }}
69+
manifest-file: ${{ inputs.manifest-file }}
70+
token: ${{ secrets.token || github.token }}
71+
72+
- name: Summary
73+
if: ${{ steps.release.outputs.releases_created == 'true' }}
74+
env:
75+
TAG: ${{ steps.release.outputs.tag_name }}
76+
VERSION: ${{ steps.release.outputs.version }}
77+
run: |
78+
# shellcheck disable=SC2016 # printf interprets the format string; single quotes are correct
79+
{
80+
printf '## Release Created\n\n'
81+
printf '| Tag | Version |\n'
82+
printf '|-----|---------|\n'
83+
printf '| `%s` | `%s` |\n' "$TAG" "$VERSION"
84+
} >> "$GITHUB_STEP_SUMMARY"
85+
86+
- name: Summary - No Release
87+
if: ${{ steps.release.outputs.releases_created != 'true' }}
88+
run: |
89+
# shellcheck disable=SC2016 # printf interprets the format string; single quotes are correct
90+
{
91+
printf '## No Release Created\n\n'
92+
printf 'No conventional commits requiring a release were found.\n'
93+
} >> "$GITHUB_STEP_SUMMARY"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions: {}
10+
11+
jobs:
12+
release-please:
13+
uses: ./.github/workflows/release-please-reusable.yml
14+
permissions:
15+
contents: write
16+
pull-requests: write

‎.release-please-manifest.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.0"
3+
}

‎README.md‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# github-workflows-public
2+
3+
Reusable GitHub Actions workflows for the openCoreEMR organization, hosted in a public repo so that public caller repos can use them. (GitHub blocks public repos from calling reusable workflows in private/internal repos.)
4+
5+
Consumers reference workflows here as:
6+
7+
```yaml
8+
uses: opencoreemr/github-workflows-public/.github/workflows/<name>.yml@<ref>
9+
```
10+
11+
## Versioning
12+
13+
Releases are managed by [release-please](https://github.com/googleapis/release-please) using the openCoreEMR fork ([release-please-action](https://github.com/openCoreEMR/release-please-action)) which adds annotated-tag support. Conventional commits to `main` automatically open a release PR; merging that PR creates an annotated tag and GitHub release.
14+
15+
Pin to a specific version tag (e.g. `@1.0.0`). Pinning to `@main` works but may break without warning.
16+
17+
## Workflows
18+
19+
### `release-please-reusable.yml`
20+
21+
Wraps the openCoreEMR release-please-action fork. Callers provide a `release-please-config.json` (with `"annotated-tag": true` to get annotated tags directly from the action) and a `.release-please-manifest.json`. Outputs include `releases_created`, `release_created`, `tag_name`, `version`, and `paths_released` so caller jobs can `needs:` the release-please job and gate on a release being created.
22+
23+
Inputs:
24+
25+
| Name | Type | Default | Description |
26+
|------------------------|--------|----------------------------------|------------------------------------------|
27+
| `config-file` | string | `release-please-config.json` | Path to the release-please config |
28+
| `manifest-file` | string | `.release-please-manifest.json` | Path to the release-please manifest |
29+
| `runs-on` | string | `ubuntu-latest` | Runner label |
30+
| `checkout-fetch-depth` | number | `0` | `fetch-depth` for `actions/checkout` |
31+
32+
Secrets:
33+
34+
| Name | Required | Description |
35+
|---------|----------|--------------------------------------------------------------|
36+
| `token` | no | Token for checkout and release-please. Falls back to caller's `GITHUB_TOKEN`. |
37+
38+
The pinned action ref (`openCoreEMR/release-please-action@v5.0.0-oce.1`) is hardcoded — GitHub Actions does not allow expressions in `uses:` references, so it can't be a workflow input.

‎release-please-config.json‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"release-type": "simple",
4+
"include-v-in-tag": false,
5+
"include-component-in-tag": false,
6+
"bump-minor-pre-major": true,
7+
"bump-patch-for-minor-pre-major": true,
8+
"annotated-tag": true,
9+
"packages": {
10+
".": {
11+
"package-name": "github-workflows-public"
12+
}
13+
},
14+
"changelog-sections": [
15+
{"type": "feat", "section": "Features"},
16+
{"type": "fix", "section": "Bug Fixes"},
17+
{"type": "perf", "section": "Performance Improvements"},
18+
{"type": "revert", "section": "Reverts"},
19+
{"type": "docs", "section": "Documentation"},
20+
{"type": "style", "section": "Styles", "hidden": true},
21+
{"type": "chore", "section": "Miscellaneous Chores", "hidden": true},
22+
{"type": "refactor", "section": "Code Refactoring", "hidden": true},
23+
{"type": "test", "section": "Tests", "hidden": true},
24+
{"type": "build", "section": "Build System", "hidden": true},
25+
{"type": "ci", "section": "Continuous Integration", "hidden": true},
26+
{"type": "deps", "section": "Dependencies"}
27+
]
28+
}

0 commit comments

Comments
 (0)