Skip to content

Commit 95fcf4e

Browse files
authored
feat: Initial workflows (#1)
1 parent d367e99 commit 95fcf4e

11 files changed

Lines changed: 267 additions & 0 deletions

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This is a CODEOWNERS file. It defines who is responsible for different parts of the codebase.
2+
# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
3+
4+
# These owners will be the default owners for everything in the repo.
5+
* @AndyRae
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Dependency Review (self)
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
dependency-review:
8+
uses: ./.github/workflows/dependency-review.yml
9+
secrets: inherit
10+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Dependency Review
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
dependency-review:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Dependency review
18+
uses: actions/dependency-review-action@v4
19+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: PR Title Check (self)
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
pr-title:
8+
uses: ./.github/workflows/pr-title.yml
9+
secrets: inherit
10+

.github/workflows/pr-title.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: PR Title Check
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
pull-requests: read
8+
9+
jobs:
10+
pr-title:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Validate PR title
15+
uses: amannn/action-semantic-pull-request@v5
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+

.github/workflows/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Release (self)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
uses: ./.github/workflows/semantic-release.yml
11+
with:
12+
node-version: '20'
13+
secrets: inherit
14+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Semantic Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
node-version:
7+
description: 'Node.js version to use'
8+
required: false
9+
default: '24'
10+
type: string
11+
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
issues: write
16+
17+
jobs:
18+
release:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: ${{ inputs.node-version }}
29+
30+
- name: Install Semantic Release and plugins
31+
run: |
32+
npm install -g semantic-release \
33+
@semantic-release/commit-analyzer \
34+
@semantic-release/exec \
35+
@semantic-release/release-notes-generator \
36+
@semantic-release/changelog \
37+
@semantic-release/github
38+
39+
- name: Run Semantic Release
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
run: semantic-release
43+

docs/dependency-review.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dependency Review
2+
3+
Reusable workflow that runs [Dependency Review](https://github.com/actions/dependency-review-action) on pull requests. It checks dependency changes (e.g. in `package.json`, `package-lock.json`, `Pipfile`, `go.sum`) for known vulnerabilities and license issues.
4+
5+
## Inputs
6+
7+
None.
8+
9+
## Secrets
10+
11+
- `GITHUB_TOKEN` — Pass with `secrets: inherit` so the action can read the repo and comment on the PR.
12+
13+
## Usage
14+
15+
In your repo, add a workflow that runs on pull requests:
16+
17+
```yaml
18+
name: Dependency Review
19+
20+
on:
21+
pull_request:
22+
23+
jobs:
24+
dependency-review:
25+
uses: health-informatics-uon/workflows/.github/workflows/dependency-review.yml@main
26+
secrets: inherit
27+
```
28+
29+
Replace `@main` with the branch where this reusable workflow is defined.

docs/pr-title.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# PR Title Check
2+
3+
Reusable workflow that validates pull request titles using [action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request). Titles must follow a conventional-commit style (e.g. `feat: add login`, `fix: resolve crash`).
4+
5+
## Inputs
6+
7+
None.
8+
9+
## Secrets
10+
11+
- `GITHUB_TOKEN` — Pass with `secrets: inherit` so the action can read the PR and post status checks.
12+
13+
## Usage
14+
15+
In your repo, add a workflow that runs on pull requests:
16+
17+
```yaml
18+
name: PR Title Check
19+
20+
on:
21+
pull_request:
22+
23+
jobs:
24+
pr-title:
25+
uses: health-informatics-uon/workflows/.github/workflows/pr-title.yml@main
26+
secrets: inherit
27+
```
28+
29+
Replace `@main` with the branch where this reusable workflow is defined.

docs/semantic-release.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Semantic Release
2+
3+
Reusable workflow that runs [semantic-release](https://github.com/semantic-release/semantic-release) to determine the next version from commits and publish a GitHub release. Expects a [semantic-release config](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md) (e.g. `release.config.js` or `.releaserc`) in the calling repository.
4+
5+
## Inputs
6+
7+
| Input | Required | Default | Description |
8+
|----------------|----------|---------|----------------------------|
9+
| `node-version` | No | `'24'` | Node.js version to use. |
10+
11+
## Secrets
12+
13+
- `GITHUB_TOKEN` — Pass with `secrets: inherit` (or set explicitly) so the workflow can create releases and comment on PRs/issues.
14+
15+
## Usage
16+
17+
In your repo, add a workflow that runs on push to `main` (or your release branch):
18+
19+
```yaml
20+
name: Release
21+
22+
on:
23+
push:
24+
branches:
25+
- main
26+
27+
jobs:
28+
release:
29+
uses: health-informatics-uon/workflows/.github/workflows/semantic-release.yml@main
30+
with:
31+
node-version: '24' # optional
32+
secrets: inherit
33+
```
34+
35+
Ensure the branch in `@main` matches the branch where this reusable workflow is defined.
36+
37+
`release.config.js`
38+
39+
```json copy
40+
module.exports = {
41+
"branches": ["main"],
42+
"tagFormat": "${version}",
43+
"preset": "angular",
44+
"repositoryUrl": "https://github.com/Health-Informatics-UoN/[REPO_NAME].git",
45+
plugins: [
46+
'@semantic-release/commit-analyzer',
47+
'@semantic-release/release-notes-generator',
48+
'@semantic-release/exec',
49+
'@semantic-release/github',
50+
],
51+
"initialVersion": "0.0.1"
52+
};
53+
```
54+
55+
## Python Configuration
56+
57+
In `pyproject.toml` use `hatch-vcs` for a dynamic version.
58+
59+
```toml copy
60+
dynamic = ["version"]
61+
62+
[build-system]
63+
requires = ["hatchling", "hatch-vcs"]
64+
build-backend = "hatchling.build"
65+
66+
[tool.hatch.version]
67+
source = "vcs"
68+
69+
```
70+
71+
## C# Configuration
72+
73+
TODO
74+
75+
## Javascript Configuration
76+
77+
TODO

0 commit comments

Comments
 (0)