From 700e577c24bdd8794897113cd1e32327398b2131 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Wed, 21 Jan 2026 15:28:25 +0100 Subject: [PATCH 1/2] Migrate to shared-workflows for release process --- .github/workflows/changelog.yml | 15 +--- .github/workflows/commit.yml | 25 +----- .github/workflows/release.yml | 133 +++++--------------------------- 3 files changed, 23 insertions(+), 150 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 59bb0e908..896c14694 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -3,20 +3,7 @@ name: Changelog on: pull_request: workflow_dispatch: - workflow_call: - outputs: - release-type: - description: The release type extracted from changelog - value: ${{ jobs.validate.outputs.release-type }} jobs: validate: - runs-on: [ ubuntu-latest ] - outputs: - release-type: ${{ steps.validate-changelog.outputs.release-type }} - steps: - - uses: actions/checkout@v4 - - - name: Validate changelog - id: validate-changelog - uses: OpenTermsArchive/changelog-action/validate@v0.2.0 + uses: OpenTermsArchive/shared-workflows/.github/workflows/changelog.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0 diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 28b3f0902..8489167ba 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -1,29 +1,8 @@ name: Lint commit messages -on: +on: pull_request: -permissions: - contents: read - pull-requests: read - jobs: commitlint: - runs-on: ubuntu-latest - steps: - - name: Checkout "main" branch - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.base.ref }} - - - name: Checkout the current pull request branch - run: | - git fetch --no-tags origin +refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }} - git checkout ${{ github.event.pull_request.head.ref }} - - - name: Install dependencies - run: npm ci - - - name: Lint commit messages - run: npm run commit-messages:lint + uses: OpenTermsArchive/shared-workflows/.github/workflows/commit.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7785b23aa..cf760e43d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,132 +15,39 @@ permissions: jobs: release-decision: - runs-on: ubuntu-latest - outputs: - should-release: ${{ steps.decision.outputs.should-release }} - steps: - - name: Decide release - id: decision - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COMMITTER_EMAIL: ${{ github.event.head_commit.committer.email }} - COMMITTER_NAME: ${{ github.event.head_commit.committer.name }} - COMMIT_SHA: ${{ github.sha }} - shell: bash - run: | - echo "Commit: $COMMIT_SHA" - echo "Committer: $COMMITTER_NAME <$COMMITTER_EMAIL>" - - # Skip if commit is from release bot (avoid infinite loop) - if [[ "$COMMITTER_EMAIL" == 'release-bot@opentermsarchive.org' ]]; then - echo "→ Skipping: commit is from release bot" - echo "should-release=false" >> "$GITHUB_OUTPUT" - exit 0 - fi - - # Check if commit comes from a PR merged to main - PR_JSON=$(gh pr list \ - --repo "${{ github.repository }}" \ - --search "$COMMIT_SHA is:merged base:main" \ - --state merged \ - --json number,title,url) - - PR_COUNT=$(echo "$PR_JSON" | jq 'length') - - if [[ "$PR_COUNT" -gt 0 ]]; then - echo "$PR_JSON" | jq -r '.[] | "→ Found PR #\(.number): \(.title)"' - echo "→ Release will proceed" - echo "should-release=true" >> "$GITHUB_OUTPUT" - else - echo "→ No merged PR found for this commit" - echo "should-release=false" >> "$GITHUB_OUTPUT" - fi + uses: OpenTermsArchive/shared-workflows/.github/workflows/release-decision.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0 changelog: needs: release-decision if: ${{ needs.release-decision.outputs.should-release == 'true' }} - uses: "./.github/workflows/changelog.yml" + uses: OpenTermsArchive/shared-workflows/.github/workflows/changelog.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0 + test: needs: changelog if: ${{ needs.changelog.outputs.release-type != 'no-release' }} - uses: "OpenTermsArchive/engine/.github/workflows/test.yml@main" - release: - needs: test - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: main - token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} - - - uses: actions/setup-node@v4 - with: - node-version: '24' - registry-url: 'https://registry.npmjs.org' - - - name: Configure Git author - run: | - git config --global user.name "Open Terms Archive Release Bot" - git config --global user.email "release-bot@opentermsarchive.org" - - - name: Update changelog for release - id: release-changelog - uses: OpenTermsArchive/changelog-action/release@v0.2.0 - - - name: Bump package version - run: npm --no-git-tag-version version ${{ steps.release-changelog.outputs.version }} - - - name: Commit CHANGELOG.md and package.json changes and create tag - run: | - git add "package.json" - git add "package-lock.json" - git add "CHANGELOG.md" - git commit -m "Release v${{ steps.release-changelog.outputs.version }}" - git tag v${{ steps.release-changelog.outputs.version }} + uses: OpenTermsArchive/engine/.github/workflows/test.yml@main - # Publish to NPM first, before pushing to repository. If this fails, no changes are pushed to the repository, ensuring consistency - - name: Publish to NPM public repository - run: npm publish --provenance - - # Only push to repository after successful NPM publish - - name: Push changes to repository - run: git push origin main && git push --tags + release: + needs: [changelog, test] + if: ${{ needs.changelog.outputs.release-type != 'no-release' }} + uses: OpenTermsArchive/shared-workflows/.github/workflows/release.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0 + secrets: inherit - - name: Create GitHub release - uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2 - with: - tag_name: v${{ steps.release-changelog.outputs.version }} - body: ${{ steps.release-changelog.outputs.content }} - token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} + clean-changelog: + needs: changelog + if: ${{ needs.changelog.outputs.release-type == 'no-release' }} + uses: OpenTermsArchive/shared-workflows/.github/workflows/clean-changelog.yml@4565230eda2a36c5270784cd73452743dc0a69ed # v0.2.0 + secrets: inherit + trigger-docs: + needs: release + if: ${{ needs.release.outputs.released == 'true' }} + runs-on: ubuntu-latest + steps: - name: Trigger documentation deploy uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2 with: token: ${{ secrets.TRIGGER_DOCS_DEPLOY_TOKEN }} event-type: engine-release repository: OpenTermsArchive/docs - client-payload: '{"version": "v${{ steps.release-changelog.outputs.version }}"}' - - clean_changelog: - needs: changelog - if: ${{ needs.changelog.outputs.release-type == 'no-release' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: main - token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} - - - name: Configure Git author - run: | - git config --global user.name "Open Terms Archive Release Bot" - git config --global user.email "release-bot@opentermsarchive.org" - - - name: Update changelog for release - uses: OpenTermsArchive/changelog-action/release@v0.2.0 - - - name: Save changelog - run: | - git commit -m "Clean changelog" CHANGELOG.md - git push origin main + client-payload: '{"version": "v${{ needs.release.outputs.version }}"}' From cb7b99d61d1cb0f11c8af6d9a4d7455bc22ae928 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Wed, 21 Jan 2026 15:29:05 +0100 Subject: [PATCH 2/2] Add changelog entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7472d838..1810a9fc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ 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). +## Unreleased [no-release] + +_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._ + ## 10.5.0 - 2026-01-20 > Development of this release was supported by [Reset Tech](https://www.reset.tech).