Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ pkg/operator/crds/*.yaml linguist-generated=true
Makefile text eol=lf
tools/make/*.mk text eol=lf
tools/image-tag text eol=lf
tools/release text eol=lf
tools/mkrelease text eol=lf
71 changes: 0 additions & 71 deletions .github/workflows/backport.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/lint-pr-title.yml
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@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"
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
packaging,\
production,\
tools/ci,\
tools/release,\
tools/mkrelease,\
docs/sources/tutorials/assets\
"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-alloy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,6 @@ jobs:

- name: Publish
run: |
VERSION="${GITHUB_REF_NAME}" RELEASE_DOC_TAG=$(echo "${GITHUB_REF_NAME}" | awk -F '.' '{print $1"."$2}') ./tools/release
VERSION="${GITHUB_REF_NAME}" RELEASE_DOC_TAG=$(echo "${GITHUB_REF_NAME}" | awk -F '.' '{print $1"."$2}') ./tools/mkrelease
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
92 changes: 92 additions & 0 deletions .github/workflows/release-backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
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

- 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 }}
run: |
cd tools
labels='${{ steps.check.outputs.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
60 changes: 60 additions & 0 deletions .github/workflows/release-create-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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 }}

- 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 }}
run: |
cd tools
go run ./release/create-release-branch --source "${{ inputs.source_ref }}" ${{ inputs.dry_run == true && '--dry-run' || '' }}
65 changes: 65 additions & 0 deletions .github/workflows/release-create-rc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Create Release Candidate

on:
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (do not create tag or release)'
type: boolean
default: true # For safety!

permissions:
contents: write
pull-requests: read
id-token: write

jobs:
create-rc:
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 branch format 🔎
run: |
BRANCH="${{ github.ref_name }}"
if [[ ! "$BRANCH" =~ ^release/v[0-9]+\.[0-9]+$ ]]; then
echo "::error::This workflow must be run from a release branch (release/vX.Y)"
echo "::error::Selected branch: $BRANCH"
exit 1
fi
echo "✅ Running on release branch: $BRANCH"

- name: Checkout repository 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}

- 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-rc tool 🚀
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
cd tools
go run ./release/create-rc --branch "${{ github.ref_name }}" ${{ inputs.dry_run == true && '--dry-run' || '' }}
Loading
Loading