-
Notifications
You must be signed in to change notification settings - Fork 50
ci: replace auto and lerna with release-please #2689
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
Open
jackw
wants to merge
14
commits into
main
Choose a base branch
from
jackw/release-please
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.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8e4f896
chore: add release-please config
jackw df48e05
chore: add release-please-manifest.json
jackw 244e0f6
ci: add release-please config consistency check
jackw abc17ab
ci(release): add workflow for releasing packages using release-please
jackw a49747b
ci: remove release step from ci.yml
jackw b705182
chore(deps): remove auto and lerna deps, hoist nx
jackw 97868ea
docs(contributing): update guide to explain release-please process
jackw 03a7091
docs: remove auto badge, update agents nx version
jackw d5f91f1
chore(auto): delete config
jackw 0b9bed2
chore(lerna): delete config
jackw fb29fdf
chore: delete root changelog
jackw 9639d17
ci(release): split release into two jobs to implement gh env protection
jackw b89b98c
ci(release): clean up permissions
jackw 7aef2de
ci: address pr feedback on release-please workflow
jackw 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 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,24 @@ | ||
| name: Check release-please config | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'packages/**' | ||
| - 'release-please-config.json' | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Verify release-please config covers every package | ||
| run: | | ||
| set -euo pipefail | ||
| declared=$(jq -r '.packages | keys[]' release-please-config.json | sort) | ||
| actual=$(find packages -mindepth 1 -maxdepth 1 -type d | sort) | ||
| diff <(echo "$declared") <(echo "$actual") || { | ||
| echo "release-please-config.json is out of sync with packages/ directory" >&2 | ||
| exit 1 | ||
| } |
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,124 @@ | ||
| name: Release | ||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write # required to assume roles from GitHub's OIDC. | ||
| concurrency: | ||
| group: release | ||
| cancel-in-progress: false | ||
| outputs: | ||
| releases_created: ${{ steps.release.outputs.releases_created }} | ||
| paths_released: ${{ steps.release.outputs.paths_released }} | ||
| steps: | ||
| - name: Generate token | ||
| id: app-token | ||
| uses: grafana/shared-workflows/actions/create-github-app-token@259ba21cb3ff07724f331e26d926d655d24b317b # create-github-app-token/v0.2.3 | ||
| with: | ||
| github_app: grafana-plugins-platform-bot | ||
| permission_set: release | ||
|
|
||
| - id: release | ||
| uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 | ||
| with: | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| config-file: release-please-config.json | ||
| manifest-file: .release-please-manifest.json | ||
|
|
||
| publish: | ||
| needs: release | ||
| if: ${{ needs.release.outputs.releases_created == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write # required for npm Trusted Publishing (OIDC) | ||
| environment: npm-publish | ||
| concurrency: | ||
| group: npm-publish | ||
| cancel-in-progress: false | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: .nvmrc | ||
| registry-url: 'https://registry.npmjs.org' | ||
| package-manager-cache: false | ||
|
|
||
| - name: Install npm for npm stage publish | ||
| run: npm install -g npm@11.15.0 | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --no-audit | ||
|
|
||
| # Build all packages to ensure dist files are present for publishing | ||
| # Nx and release please don't share the same dependency graph so safer to build everything. | ||
| - name: Build all packages | ||
| run: npm run build | ||
|
|
||
| - name: Publish to npm | ||
| env: | ||
| PATHS_RELEASED: ${{ needs.release.outputs.paths_released }} | ||
| run: | | ||
| set -euo pipefail | ||
| echo "$PATHS_RELEASED" | jq -r '.[]' | while read -r path; do | ||
| echo "Publishing $path" | ||
| (cd "$path" && npm stage publish --provenance --access public) | ||
| done | ||
|
|
||
| - name: Build Slack payload | ||
| id: slack-payload | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | ||
| env: | ||
| PATHS_RELEASED: ${{ needs.release.outputs.paths_released }} | ||
| REPO: ${{ github.repository }} | ||
| with: | ||
| script: | | ||
| const fs = require('node:fs'); | ||
| const paths = JSON.parse(process.env.PATHS_RELEASED); | ||
| const lines = paths.map((p) => { | ||
| const { name, version } = JSON.parse(fs.readFileSync(`${p}/package.json`, 'utf8')); | ||
| const tag = `${name}@${version}`; | ||
| const releaseUrl = `https://github.com/${process.env.REPO}/releases/tag/${encodeURIComponent(tag)}`; | ||
| const npmUrl = `https://www.npmjs.com/package/${name}`; | ||
| return [ | ||
| `β’ *<${releaseUrl}|${tag}>* - <${npmUrl}|npm>` | ||
| ].join('\n'); | ||
| }); | ||
| const payload = { | ||
| channel: 'C09CY9URN31', | ||
| text: `:package: Beep Boop! :robot: Plugin tools ${paths.length} package${paths.length === 1 ? '' : 's'} staged for release`, | ||
| blocks: [ | ||
| { | ||
| type: 'header', | ||
| text: { type: 'plain_text', text: `:package: Beep Boop! :robot: Plugin tools ${paths.length} package${paths.length === 1 ? '' : 's'} staged for release` }, | ||
| }, | ||
| { | ||
| type: 'section', | ||
| text: { type: 'mrkdwn', text: lines.join('\n') }, | ||
| }, | ||
| { | ||
| type: 'context', | ||
| elements: [ | ||
| { | ||
| type: 'mrkdwn', | ||
| text: `Please login to <https://www.npmjs.com/|npmjs> to approve publishing. See <https://github.com/${process.env.REPO}/blob/main/CONTRIBUTING.md#create-a-release|CONTRIBUTING.md> for the full release walkthrough.`, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }; | ||
| core.setOutput('payload', JSON.stringify(payload)); | ||
|
|
||
| - name: Notify Slack | ||
| uses: grafana/shared-workflows/actions/send-slack-message@eb1fbd807f87aea8f40ff08dc9cd02872cad55b3 # send-slack-message/v2.0.5 | ||
| with: | ||
| method: chat.postMessage | ||
| payload: ${{ steps.slack-payload.outputs.payload }} | ||
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,12 @@ | ||
| { | ||
| "packages/create-plugin": "7.7.0", | ||
| "packages/eslint-plugin-plugins": "0.7.0", | ||
| "packages/plugin-docs-cli": "0.1.0", | ||
| "packages/plugin-docs-parser": "0.1.0", | ||
| "packages/plugin-e2e": "3.9.0", | ||
| "packages/plugin-meta-extractor": "0.13.0", | ||
| "packages/plugin-types-bundler": "0.6.0", | ||
| "packages/react-detect": "0.7.0", | ||
| "packages/sign-plugin": "3.3.0", | ||
| "packages/tsconfig": "2.2.0" | ||
| } |
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.
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.
should probably also get a concurrency group