Skip to content

Commit fbf5abb

Browse files
authored
Migrate to shared-workflows for release process (#1233)
2 parents cace179 + cb7b99d commit fbf5abb

4 files changed

Lines changed: 27 additions & 150 deletions

File tree

.github/workflows/changelog.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,7 @@ name: Changelog
33
on:
44
pull_request:
55
workflow_dispatch:
6-
workflow_call:
7-
outputs:
8-
release-type:
9-
description: The release type extracted from changelog
10-
value: ${{ jobs.validate.outputs.release-type }}
116

127
jobs:
138
validate:
14-
runs-on: [ ubuntu-latest ]
15-
outputs:
16-
release-type: ${{ steps.validate-changelog.outputs.release-type }}
17-
steps:
18-
- uses: actions/checkout@v4
19-
20-
- name: Validate changelog
21-
id: validate-changelog
22-
uses: OpenTermsArchive/changelog-action/validate@v0.2.0
9+
uses: OpenTermsArchive/shared-workflows/.github/workflows/changelog.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0

.github/workflows/commit.yml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,8 @@
11
name: Lint commit messages
22

3-
on:
3+
on:
44
pull_request:
55

6-
permissions:
7-
contents: read
8-
pull-requests: read
9-
106
jobs:
117
commitlint:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout "main" branch
15-
uses: actions/checkout@v4
16-
with:
17-
fetch-depth: 0
18-
ref: ${{ github.event.pull_request.base.ref }}
19-
20-
- name: Checkout the current pull request branch
21-
run: |
22-
git fetch --no-tags origin +refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
23-
git checkout ${{ github.event.pull_request.head.ref }}
24-
25-
- name: Install dependencies
26-
run: npm ci
27-
28-
- name: Lint commit messages
29-
run: npm run commit-messages:lint
8+
uses: OpenTermsArchive/shared-workflows/.github/workflows/commit.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0

.github/workflows/release.yml

Lines changed: 20 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -15,132 +15,39 @@ permissions:
1515

1616
jobs:
1717
release-decision:
18-
runs-on: ubuntu-latest
19-
outputs:
20-
should-release: ${{ steps.decision.outputs.should-release }}
21-
steps:
22-
- name: Decide release
23-
id: decision
24-
env:
25-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
COMMITTER_EMAIL: ${{ github.event.head_commit.committer.email }}
27-
COMMITTER_NAME: ${{ github.event.head_commit.committer.name }}
28-
COMMIT_SHA: ${{ github.sha }}
29-
shell: bash
30-
run: |
31-
echo "Commit: $COMMIT_SHA"
32-
echo "Committer: $COMMITTER_NAME <$COMMITTER_EMAIL>"
33-
34-
# Skip if commit is from release bot (avoid infinite loop)
35-
if [[ "$COMMITTER_EMAIL" == 'release-bot@opentermsarchive.org' ]]; then
36-
echo "→ Skipping: commit is from release bot"
37-
echo "should-release=false" >> "$GITHUB_OUTPUT"
38-
exit 0
39-
fi
40-
41-
# Check if commit comes from a PR merged to main
42-
PR_JSON=$(gh pr list \
43-
--repo "${{ github.repository }}" \
44-
--search "$COMMIT_SHA is:merged base:main" \
45-
--state merged \
46-
--json number,title,url)
47-
48-
PR_COUNT=$(echo "$PR_JSON" | jq 'length')
49-
50-
if [[ "$PR_COUNT" -gt 0 ]]; then
51-
echo "$PR_JSON" | jq -r '.[] | "→ Found PR #\(.number): \(.title)"'
52-
echo "→ Release will proceed"
53-
echo "should-release=true" >> "$GITHUB_OUTPUT"
54-
else
55-
echo "→ No merged PR found for this commit"
56-
echo "should-release=false" >> "$GITHUB_OUTPUT"
57-
fi
18+
uses: OpenTermsArchive/shared-workflows/.github/workflows/release-decision.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0
5819

5920
changelog:
6021
needs: release-decision
6122
if: ${{ needs.release-decision.outputs.should-release == 'true' }}
62-
uses: "./.github/workflows/changelog.yml"
23+
uses: OpenTermsArchive/shared-workflows/.github/workflows/changelog.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0
24+
6325
test:
6426
needs: changelog
6527
if: ${{ needs.changelog.outputs.release-type != 'no-release' }}
66-
uses: "OpenTermsArchive/engine/.github/workflows/test.yml@main"
67-
release:
68-
needs: test
69-
runs-on: ubuntu-latest
70-
steps:
71-
- name: Checkout
72-
uses: actions/checkout@v4
73-
with:
74-
ref: main
75-
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
76-
77-
- uses: actions/setup-node@v4
78-
with:
79-
node-version: '24'
80-
registry-url: 'https://registry.npmjs.org'
81-
82-
- name: Configure Git author
83-
run: |
84-
git config --global user.name "Open Terms Archive Release Bot"
85-
git config --global user.email "release-bot@opentermsarchive.org"
86-
87-
- name: Update changelog for release
88-
id: release-changelog
89-
uses: OpenTermsArchive/changelog-action/release@v0.2.0
90-
91-
- name: Bump package version
92-
run: npm --no-git-tag-version version ${{ steps.release-changelog.outputs.version }}
93-
94-
- name: Commit CHANGELOG.md and package.json changes and create tag
95-
run: |
96-
git add "package.json"
97-
git add "package-lock.json"
98-
git add "CHANGELOG.md"
99-
git commit -m "Release v${{ steps.release-changelog.outputs.version }}"
100-
git tag v${{ steps.release-changelog.outputs.version }}
28+
uses: OpenTermsArchive/engine/.github/workflows/test.yml@main
10129

102-
# Publish to NPM first, before pushing to repository. If this fails, no changes are pushed to the repository, ensuring consistency
103-
- name: Publish to NPM public repository
104-
run: npm publish --provenance
105-
106-
# Only push to repository after successful NPM publish
107-
- name: Push changes to repository
108-
run: git push origin main && git push --tags
30+
release:
31+
needs: [changelog, test]
32+
if: ${{ needs.changelog.outputs.release-type != 'no-release' }}
33+
uses: OpenTermsArchive/shared-workflows/.github/workflows/release.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0
34+
secrets: inherit
10935

110-
- name: Create GitHub release
111-
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
112-
with:
113-
tag_name: v${{ steps.release-changelog.outputs.version }}
114-
body: ${{ steps.release-changelog.outputs.content }}
115-
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
36+
clean-changelog:
37+
needs: changelog
38+
if: ${{ needs.changelog.outputs.release-type == 'no-release' }}
39+
uses: OpenTermsArchive/shared-workflows/.github/workflows/clean-changelog.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0
40+
secrets: inherit
11641

42+
trigger-docs:
43+
needs: release
44+
if: ${{ needs.release.outputs.released == 'true' }}
45+
runs-on: ubuntu-latest
46+
steps:
11747
- name: Trigger documentation deploy
11848
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2
11949
with:
12050
token: ${{ secrets.TRIGGER_DOCS_DEPLOY_TOKEN }}
12151
event-type: engine-release
12252
repository: OpenTermsArchive/docs
123-
client-payload: '{"version": "v${{ steps.release-changelog.outputs.version }}"}'
124-
125-
clean_changelog:
126-
needs: changelog
127-
if: ${{ needs.changelog.outputs.release-type == 'no-release' }}
128-
runs-on: ubuntu-latest
129-
steps:
130-
- uses: actions/checkout@v4
131-
with:
132-
ref: main
133-
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
134-
135-
- name: Configure Git author
136-
run: |
137-
git config --global user.name "Open Terms Archive Release Bot"
138-
git config --global user.email "release-bot@opentermsarchive.org"
139-
140-
- name: Update changelog for release
141-
uses: OpenTermsArchive/changelog-action/release@v0.2.0
142-
143-
- name: Save changelog
144-
run: |
145-
git commit -m "Clean changelog" CHANGELOG.md
146-
git push origin main
53+
client-payload: '{"version": "v${{ needs.release.outputs.version }}"}'

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## Unreleased [no-release]
6+
7+
_Modifications made in this changeset do not add, remove or alter any behavior, dependency, API or functionality of the software. They only change non-functional parts of the repository, such as the README file or CI workflows._
8+
59
## 10.5.0 - 2026-01-20
610

711
> Development of this release was supported by [Reset Tech](https://www.reset.tech).

0 commit comments

Comments
 (0)