-
Notifications
You must be signed in to change notification settings - Fork 2.8k
ci: migrate to npm trusted publishing (OIDC) and update publishing workflow #16630
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
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d811de9
chore: update to lerna 9
ndoschek 98a8a78
remove publish:next call after GH pages were published
ndoschek 50fa593
chore: merge publish workflows to one trusted workflow
ndoschek 47a1e6b
doc: update publishing guide about trusted publishing and new packages
ndoschek 8583f5b
ci: add new workflow that comments a checklist for new packages
ndoschek 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 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,93 @@ | ||
| name: Check New Theia Package | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [master] | ||
| types: [opened, synchronized, reopened] | ||
| paths: | ||
| - 'packages/*/package.json' | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| detect-new-packages: | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | ||
|
|
||
| - name: Detect if a new package was added | ||
| id: detect | ||
| run: | | ||
| git fetch origin ${{ github.base_ref }} | ||
| NEW_PACKAGES=$(git diff --name-only --diff-filter=A origin/${{ github.base_ref }}...HEAD | grep -E '^packages/[^/]+/package\.json$' || true) | ||
| if [ -z "$NEW_PACKAGES" ]; then | ||
| echo "new_package_found=false" >> $GITHUB_OUTPUT | ||
| echo "No new packages detected" | ||
| else | ||
| echo "new_package_found=true" >> $GITHUB_OUTPUT | ||
| PACKAGE_NAMES=$(echo "$NEW_PACKAGES" | sed 's|packages/\([^/]*\)/package\.json|\1|' | tr '\n' ',' | sed 's/,$//') | ||
| echo "package_names=$PACKAGE_NAMES" >> $GITHUB_OUTPUT | ||
| echo "New packages detected: $PACKAGE_NAMES" | ||
| fi | ||
| - name: Post or update checklist comment | ||
| if: steps.detect.outputs.new_package_found == 'true' | ||
| uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3.2.0 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const packageNames = '${{ steps.detect.outputs.package_names }}'; | ||
| const packageList = packageNames.split(',').map(name => `\`${name}\``).join(', '); | ||
| const commentBody = "### New `@theia` Package(s) Detected | ||
| This PR adds the following new package(s): ${packageList} | ||
| Please ensure the following checklist items are completed before merging: | ||
| - [ ] `package.json` contains all required fields (name, version, description, license, etc.) and scripts | ||
| - [ ] `README.md` was added (please align with the existing README structure, e.g. [README.md](https://github.com/eclipse-theia/theia/blob/master/packages/editor/README.md)) | ||
| - [ ] Config files (`tsconfig.json`, `.eslintrc.js`) were added and align with the existing packages | ||
| - [ ] Folder structure follows Theia conventions (see [Code Organization](https://github.com/eclipse-theia/theia/blob/master/doc/code-organization.md)) | ||
| - [ ] Package is added to the example applications (i.e. `browser`, `browser-only`, `electron`) | ||
| - [ ] New packages must be published manually by a Theia committer initially (see also [Release Process - Newly added Theia packages](https://github.com/eclipse-theia/theia/blob/master/doc/Publishing.md#212-newly-added-theia-packages---publish-initially-to-npm)). | ||
| If you are not a committer or do not have enough time, please open a follow-up ticket with the label `toDoWithRelease` to inform the release team about the new package. | ||
| - [ ] If the package should also be part of the Theia IDE, please [open a ticket for the Theia IDE](https://github.com/eclipse-theia/theia-ide/issues/new?template=feature_request.md) | ||
| and assign the `toDoWithRelease` (see for example: <https://github.com/eclipse-theia/theia-ide/issues/615>)" | ||
| const issue_number = context.issue.number; | ||
| const owner = context.repo.owner; | ||
| const repo = context.repo.repo; | ||
| const comments = await github.issues.listComments({ | ||
| owner, | ||
| repo, | ||
| issue_number | ||
| }); | ||
| const botComment = comments.data.find(comment => | ||
| comment.user.type === 'Bot' && | ||
| comment.body.includes('New `@theia` Package(s) Detected') | ||
| ); | ||
| if (botComment) { | ||
| await github.issues.updateComment({ | ||
| owner, | ||
| repo, | ||
| comment_id: botComment.id, | ||
| body: commentBody | ||
| }); | ||
| console.log('Updated existing comment'); | ||
| } else { | ||
| await github.issues.createComment({ | ||
| owner, | ||
| repo, | ||
| issue_number, | ||
| body: commentBody | ||
| }); | ||
| console.log('Created new comment'); | ||
| } | ||
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 was deleted.
Oops, something went wrong.
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.
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 think we need to clarify that this is in the Theia IDE repo, right?
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.
No I think theia is correct, as this is about the actual publishing of a new
@theiapackage on NPM. This is part of the Theia release.Adding this newly published package to the Theia IDE is then a separate step, and right below.
(I just introduced the
todoWithReleaseconcept also for thetheiarepo as well, hope that's not too confusing?)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.
Ah yes sorry, i was confused for a second 😄 Thanks for clarifying.