-
Notifications
You must be signed in to change notification settings - Fork 0
chore!: migrate from release-please to semantic-release #104
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
Draft
frankieyan
wants to merge
11
commits into
main
Choose a base branch
from
frankie/semantic-release
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fdca781
build: add semantic-release dependencies and publishConfig
frankieyan 6a74390
ci: add semantic-release configuration
frankieyan 4dad1cf
ci: remove release-please configuration
frankieyan 28a3461
ci: make CI validation workflow reusable
frankieyan 2077f86
ci: replace release-please with semantic-release workflow
frankieyan 57c4332
ci: align semantic PR check with standard Doist pattern
frankieyan 023baa1
docs: update release process documentation in CONTRIBUTING.md
frankieyan 8e7aa97
docs: update releasing section in README.md
frankieyan 30cdfe6
chore!: drop Node 20 support
frankieyan 4194850
fix: remove provenance from publishConfig to support GitHub Packages
frankieyan 5720784
ci: revert semantic PR check trigger to pull_request
frankieyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| name: Package Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| # Enable the use of OIDC for trusted publishing and npm provenance | ||
| id-token: write | ||
| # Enable the use of GitHub Packages registry | ||
| packages: write | ||
| # Enable semantic-release to publish a GitHub release and push commits | ||
| contents: write | ||
| # Enable semantic-release to post comments on issues | ||
| issues: write | ||
| # Enable semantic-release to post comments on pull requests | ||
| pull-requests: write | ||
|
|
||
| # Release workflow steps must complete fully to avoid inconsistent state (e.g., published to | ||
| # npm but not GitHub Packages), so new workflow runs are queued until the previous one finishes. | ||
| concurrency: | ||
| group: ${{ github.workflow }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| ci-validation: | ||
| name: CI Validation | ||
| uses: ./.github/workflows/check-pull-request-health.yml | ||
|
|
||
| release-and-publish: | ||
| name: Release & Publish | ||
| needs: ci-validation | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
|
|
||
| steps: | ||
| - name: Generate bot token | ||
| id: generate_token | ||
| uses: actions/create-github-app-token@v2 | ||
| with: | ||
| app-id: ${{ secrets.DOIST_RELEASE_BOT_ID }} | ||
| private-key: ${{ secrets.DOIST_RELEASE_BOT_PRIVATE_KEY }} | ||
| permission-contents: write | ||
| permission-issues: write | ||
| permission-pull-requests: write | ||
|
|
||
| - name: Get bot user ID | ||
| id: bot_user | ||
| run: | | ||
| user_id=$(gh api "/users/${{ steps.generate_token.outputs.app-slug }}[bot]" --jq .id) | ||
| if [ -z "$user_id" ]; then | ||
| echo "Failed to get bot user ID" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "id=$user_id" >> "$GITHUB_OUTPUT" | ||
| env: | ||
| GH_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| token: ${{ steps.generate_token.outputs.token }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Prepare Node.js environment | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| cache: npm | ||
| node-version-file: .node-version | ||
| scope: '@doist' | ||
| registry-url: 'https://registry.npmjs.org/' | ||
|
|
||
| - name: Install project npm dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build package | ||
| run: npm run build | ||
|
|
||
| # The Node.js environment is prepared with the public npm registry and OIDC | ||
| # authentication for the initial semantic-release publish, after which we remove | ||
| # the Doist registry configuration and prepare the Node.js environment for the | ||
| # GitHub Packages registry, providing a predictable release workflow for both. | ||
| - name: Release and publish to public npm registry | ||
| id: semantic-release | ||
| run: npx semantic-release | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
| GIT_AUTHOR_NAME: ${{ steps.generate_token.outputs.app-slug }}[bot] | ||
| GIT_AUTHOR_EMAIL: ${{ steps.bot_user.outputs.id }}+${{ steps.generate_token.outputs.app-slug }}[bot]@users.noreply.github.com | ||
| GIT_COMMITTER_NAME: ${{ steps.generate_token.outputs.app-slug }}[bot] | ||
| GIT_COMMITTER_EMAIL: ${{ steps.bot_user.outputs.id }}+${{ steps.generate_token.outputs.app-slug }}[bot]@users.noreply.github.com | ||
|
|
||
| - name: Remove Doist registry configuration from .npmrc | ||
| if: ${{ steps.semantic-release.outputs.package-published == 'true' }} | ||
| run: npm config delete @doist:registry --location=project | ||
|
|
||
| - name: Prepare Node.js environment for GitHub Packages registry | ||
| if: ${{ steps.semantic-release.outputs.package-published == 'true' }} | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| cache: npm | ||
| node-version-file: .node-version | ||
| registry-url: https://npm.pkg.github.com/ | ||
| scope: '@doist' | ||
|
|
||
| - name: Publish package to GitHub Packages registry | ||
| if: ${{ steps.semantic-release.outputs.package-published == 'true' }} | ||
| run: npm publish | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.