-
Notifications
You must be signed in to change notification settings - Fork 18
chore: migrate from Release Please to semantic-release #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Remove Release Please configuration and workflows - Remove amannn/action-semantic-pull-request (addresses issue #46) - Add semantic-release with conventional commits preset - Add commitlint for PR title validation using official GitHub Actions - Configure release workflow to trigger after CI validation - Match configuration patterns from typist repository BREAKING CHANGE: Release process now uses semantic-release instead of Release Please. Releases will be triggered automatically on merge to main after CI passes.
5a47b5f to
5242992
Compare
| run: npm run build | ||
|
|
||
| - name: Release | ||
| id: semantic-release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this, it's not being used.
| id: semantic-release |
| - name: Release | ||
| id: semantic-release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Typist we are using secrets.GH_REPO_TOKEN, which comes from organization secrets. I don't see that one in this repo's secrets. Not sure if I'm missing permissions, or it's just not there for some reason. But I would suggest use the same token to avoid issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also suggest we add the following env vars:
GIT_AUTHOR_EMAIL: [email protected]
GIT_AUTHOR_NAME: Doist Bot
GIT_COMMITTER_EMAIL: [email protected]
GIT_COMMITTER_NAME: Doist Bot
| permissions: | ||
| contents: write | ||
| issues: write | ||
| pull-requests: write | ||
| packages: write | ||
| id-token: write |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so it's clear what these are for.
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| packages: write | |
| id-token: write | |
| permissions: | |
| # Enable the use of OIDC for npm provenance | |
| id-token: write | |
| # Enable the use of GitHub Packages registry | |
| packages: write | |
| # Enable `semantic-release` to publish a GitHub release and post comments on issues/PRs | |
| contents: write | |
| issues: write | |
| pull-requests: write |
| packages: write | ||
| id-token: write | ||
|
|
||
| jobs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important we add this for the reasons mentioned in the comment (although we are not publishing this go GH Packages, I still think it's important to prevent a release in progress from being cancelled):
| jobs: | |
| # The release workflow involves many crucial steps that once triggered it shouldn't be cancelled | |
| # until it's finished, otherwise we might end up in an inconsistent state (e.g., a new release | |
| # published to npm but not GitHub Packages). To prevent this, concurrency is disabled with | |
| # `cancel-in-progress: false`, and new workflow runs will be queued to be started only when the | |
| # previous one has completely finished. | |
| concurrency: | |
| group: todoist-ai-package-release | |
| cancel-in-progress: false | |
| jobs: |
| name: PR Title Lint | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - edited | ||
| - synchronize | ||
|
|
||
| jobs: | ||
| lint-pr-title: | ||
| name: Lint PR Title | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 'lts/*' | ||
|
|
||
| - name: Install commitlint | ||
| run: npm install @commitlint/cli @commitlint/config-conventional | ||
|
|
||
| - name: Lint PR title | ||
| run: echo "${{ github.event.pull_request.title }}" | npx commitlint No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mentioned in the PR description:
Removes the non-approved third-party action
amannn/action-semantic-pull-request
However, the version that Typist is using has been validated and approved, so I think we can safely use that one:
| name: PR Title Lint | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - edited | |
| - synchronize | |
| jobs: | |
| lint-pr-title: | |
| name: Lint PR Title | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| - name: Install commitlint | |
| run: npm install @commitlint/cli @commitlint/config-conventional | |
| - name: Lint PR title | |
| run: echo "${{ github.event.pull_request.title }}" | npx commitlint | |
| name: Semantic Pull Request | |
| on: | |
| pull_request_target: | |
| types: | |
| - edited | |
| - opened | |
| - synchronize | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| jobs: | |
| validate-title: | |
| name: Validate Title | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Validate pull request title | |
| uses: amannn/action-semantic-pull-request@01d5fd8a8ebb9aafe902c40c53f0f4744f7381eb | |
This keeps the workflow consistent with the Typist one, which doesn't need to check out the repo and setup Node (slower).
| "@semantic-release/github", | ||
| [ | ||
| "@semantic-release/exec", | ||
| { | ||
| "verifyConditionsCmd": "echo \"package-published=false\" >> $GITHUB_OUTPUT", | ||
| "successCmd": "echo \"package-published=true\" >> $GITHUB_OUTPUT" | ||
| } | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only required if we are publishing to npm and GH Packages in the same GH workflow, which we are not currently doing in this repo.
| "@semantic-release/github", | |
| [ | |
| "@semantic-release/exec", | |
| { | |
| "verifyConditionsCmd": "echo \"package-published=false\" >> $GITHUB_OUTPUT", | |
| "successCmd": "echo \"package-published=true\" >> $GITHUB_OUTPUT" | |
| } | |
| ] | |
| "@semantic-release/github" |
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like I mentioned below, we are using the secrets.GH_REPO_TOKEN for this token in Typist, and I have a feeling these tokens are the difference between a successful release and a failed one. I would look into using GH_REPO_TOKEN from the organization secrets in both these instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go with amannn/action-semantic-pull-request@01d5fd8a8ebb9aafe902c40c53f0f4744f7381eb as mentioned above, we can delete this file as it's no longer needed.
| "@commitlint/cli": "^19.8.1", | ||
| "@commitlint/config-conventional": "^19.8.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go with amannn/action-semantic-pull-request@01d5fd8a8ebb9aafe902c40c53f0f4744f7381eb as mentioned above, we don't need these dependencies.
We do need conventional-changelog-conventionalcommits, which is missing from this file but need in the .releaserc.json configuration.
| "@commitlint/cli": "^19.8.1", | ||
| "@commitlint/config-conventional": "^19.8.1", | ||
| "@semantic-release/changelog": "^6.0.3", | ||
| "@semantic-release/exec": "^7.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If my suggestion to remove @semantic-release/exec from .releaserc.json, we can also remove this.
Summary
amannn/action-semantic-pull-request(fixes Use of non-approved third-party GitHub Actions #46)Changes
amannn/action-semantic-pull-requestworkflowBenefits
Test Plan
Migration Notes
After merging this PR:
NPM_TOKENsecret is properly configured in the repository