-
Notifications
You must be signed in to change notification settings - Fork 494
ci: hackathon release improvements #5049
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
jharvey10
wants to merge
22
commits into
main
Choose a base branch
from
jdh/hackathon-release-improvements
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.
+4,455
−795
Open
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
cdd6d12
chore: move release script to mkrelease
jharvey10 1e954e4
ci: add release tools
jharvey10 53749de
ci: cleanup some release tools code
jharvey10 1c5db9a
ci: add new release workflows
jharvey10 da39995
ci: fix zizmor issues
jharvey10 a968e42
ci: fix zizmor issue
jharvey10 5fa2437
chore: code review updates
jharvey10 06b964f
remove gen-versioned-files
jharvey10 d243d75
ready changelog for release-please
jharvey10 5077cda
add footer to release notes during enrichment
jharvey10 2b1f0dc
add release-please config and manifest
jharvey10 afdd1d0
repurpose mkrelease to upload assets to existing release
jharvey10 0fdd67d
code review changes
jharvey10 ece6327
docs: update developer docs
jharvey10 69b8fd4
Update tools/publish-release-assets.sh
jharvey10 d4eff58
ci: fix shell expansion quoting bug
jharvey10 a430d71
ci: revamp issue and pr locking process
jharvey10 37643be
ci: fix zizmor issues
jharvey10 fe6416e
ci: fix publish and winget manifest workflows
jharvey10 4817873
ci: adhere to release-* workflow prefix
jharvey10 a38146f
Merge branch 'main' into jdh/hackathon-release-improvements
jharvey10 9cc34fb
ci: remove extraneous versioned files check
jharvey10 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
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,61 @@ | ||
| name: PR Title Lint | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - edited | ||
| - synchronize | ||
|
|
||
| permissions: | ||
| pull-requests: read | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| lint-pr-title: | ||
| name: Validate PR title | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Get GitHub app secrets 🔐 | ||
| id: get-secrets | ||
| uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # get-vault-secrets/v1.3.0 | ||
| with: | ||
| export_env: false | ||
| repo_secrets: | | ||
| ALLOYBOT_APP_ID=alloybot:app_id | ||
| ALLOYBOT_PRIVATE_KEY=alloybot:private_key | ||
|
|
||
| - name: Generate token 🔐 | ||
| uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0 | ||
| id: app-token | ||
| with: | ||
| app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_APP_ID }} | ||
| private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_PRIVATE_KEY }} | ||
| owner: grafana | ||
| repositories: alloy | ||
|
|
||
| - name: Validate PR title 🔎 | ||
| uses: amannn/action-semantic-pull-request@e32d7e603df1aa1ba07e981f2a23455dee596825 # v5 | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| with: | ||
| # Require conventional commit types | ||
| types: | | ||
| feat | ||
| fix | ||
| docs | ||
| style | ||
| refactor | ||
| perf | ||
| test | ||
| build | ||
| ci | ||
| chore | ||
| revert | ||
| # Scope is optional | ||
| requireScope: false | ||
| # Disallow uppercase first letter in subject | ||
| subjectPattern: ^[a-z].+$ | ||
| subjectPatternError: | | ||
| The subject "{subject}" must start with a lowercase letter. | ||
| Example: "feat: add new component" not "feat: Add new component" |
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,94 @@ | ||
| name: Backport PR | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [labeled, closed] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| backport: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check if PR is merged and find backport labels 🏷️ | ||
| id: check | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const pr = context.payload.pull_request; | ||
|
|
||
| if (!pr.merged_at) { | ||
| console.log('PR is not merged, skipping'); | ||
| core.setOutput('should_backport', 'false'); | ||
| return; | ||
| } | ||
|
|
||
| const labels = pr.labels || []; | ||
| const backportLabels = labels | ||
| .map(l => l.name) | ||
| .filter(name => name.startsWith('backport/')); | ||
|
|
||
| if (backportLabels.length === 0) { | ||
| console.log('No backport labels found, skipping'); | ||
| core.setOutput('should_backport', 'false'); | ||
| return; | ||
| } | ||
|
|
||
| console.log(`PR is merged and has backport labels: ${backportLabels.join(', ')}`); | ||
| core.setOutput('labels', JSON.stringify(backportLabels)); | ||
| core.setOutput('should_backport', 'true'); | ||
|
|
||
| - name: Get GitHub app secrets 🔐 | ||
| if: steps.check.outputs.should_backport == 'true' | ||
| id: get-secrets | ||
| uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # get-vault-secrets/v1.3.0 | ||
| with: | ||
| export_env: false | ||
| repo_secrets: | | ||
| ALLOYBOT_APP_ID=alloybot:app_id | ||
| ALLOYBOT_PRIVATE_KEY=alloybot:private_key | ||
|
|
||
| - name: Generate token 🔐 | ||
| if: steps.check.outputs.should_backport == 'true' | ||
| uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0 | ||
| id: app-token | ||
| with: | ||
| app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_APP_ID }} | ||
| private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_PRIVATE_KEY }} | ||
| owner: grafana | ||
| repositories: alloy | ||
|
|
||
| - name: Checkout repository 🛎️ | ||
| if: steps.check.outputs.should_backport == 'true' | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Go 🏗️ | ||
| if: steps.check.outputs.should_backport == 'true' | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: tools/go.mod | ||
| cache-dependency-path: tools/go.sum | ||
|
|
||
| - name: Run backport tool 🍒 | ||
| if: steps.check.outputs.should_backport == 'true' | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| APP_SLUG: ${{ steps.app-token.outputs.app-slug }} | ||
| LABELS: ${{ steps.check.outputs.labels }} | ||
| run: | | ||
| cd tools | ||
| labels='${LABELS}' | ||
|
|
||
| for label in $(echo "$labels" | jq -r '.[]'); do | ||
| echo "🍒 Processing backport for label: $label" | ||
| go run ./release/backport \ | ||
| --pr "${{ github.event.pull_request.number }}" \ | ||
| --label "$label" | ||
| done | ||
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,62 @@ | ||
| name: Create Release Branch | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| source_ref: | ||
| description: 'Source ref to branch from (default: main)' | ||
| required: false | ||
| default: 'main' | ||
| type: string | ||
| dry_run: | ||
| description: 'Dry run (do not create branch)' | ||
| type: boolean | ||
| default: true # For safety! | ||
|
|
||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| create-branch: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Get GitHub app secrets 🔐 | ||
| id: get-secrets | ||
| uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # get-vault-secrets/v1.3.0 | ||
| with: | ||
| export_env: false | ||
| repo_secrets: | | ||
| ALLOYBOT_APP_ID=alloybot:app_id | ||
| ALLOYBOT_PRIVATE_KEY=alloybot:private_key | ||
|
|
||
| - name: Generate token 🔐 | ||
| uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0 | ||
| id: app-token | ||
| with: | ||
| app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_APP_ID }} | ||
| private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_PRIVATE_KEY }} | ||
| owner: grafana | ||
| repositories: alloy | ||
|
|
||
| - name: Checkout repository 🛎️ | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.source_ref }} | ||
| fetch-depth: 0 | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Go 🏗️ | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: tools/go.mod | ||
| cache-dependency-path: tools/go.sum | ||
|
|
||
| - name: Run create-release-branch tool 🌿 | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| SOURCE_REF: ${{ inputs.source_ref }} | ||
| run: | | ||
| cd tools | ||
| go run ./release/create-release-branch --source "${SOURCE_REF}" ${{ inputs.dry_run == true && '--dry-run' || '' }} |
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.