CI: use -C when go-mod-dir is provided (#105851)
* use -C when go-mod-dir is provided * remove unused target variable * use my branch for testing * fix syntax? * use condition in bash instead * dagger-for-github doesn't support multiline command * just skip using the composite action * update setup-go * add missing space * grafana-main -> .grafana-main * use 'patch' as version * use generated token for cloning / pushing * colons in wrong place * update generate-token action * reduce permissions needed * add org prefix to repositories list * ok the repo names did not work like that * pull-request -> pull_request * add workflows: write permission * push branch on dry_run * Add missing DRY_RUN flag * initialize LATEST_FLAG as array * use RELEASE_BRANCH as the base branch * use workflow in main * done testing; use main
This commit is contained in:
@@ -42,10 +42,12 @@ jobs:
|
||||
GRAFANA_DELIVERY_BOT_APP_PEM=delivery-bot-app:PRIVATE_KEY
|
||||
- name: "Generate token"
|
||||
id: generate_token
|
||||
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
|
||||
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
|
||||
with:
|
||||
app_id: ${{ vars.DELIVERY_BOT_APP_ID }}
|
||||
private_key: ${{ env.GRAFANA_DELIVERY_BOT_APP_PEM }}
|
||||
repositories: "[\"grafana\", \"grafana-enterprise\"]"
|
||||
permissions: "{\"contents\": \"write\", \"pull_requests\": \"write\", \"workflows\":\"write\"}"
|
||||
- name: Create release branch
|
||||
id: branch
|
||||
uses: grafana/grafana-github-actions-go/bump-release@main # zizmor: ignore[unpinned-uses]
|
||||
|
||||
@@ -44,13 +44,6 @@ jobs:
|
||||
VERSION: ${{ inputs.version }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Get vault secrets"
|
||||
id: vault-secrets
|
||||
uses: grafana/shared-workflows/actions/get-vault-secrets@main
|
||||
with:
|
||||
# Secrets placed in the ci/data/repo/grafana/grafana/delivery-bot-app path in Vault
|
||||
repo_secrets: |
|
||||
GRAFANA_DELIVERY_BOT_APP_PEM=delivery-bot-app:PRIVATE_KEY
|
||||
- if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') }}
|
||||
run: |
|
||||
{
|
||||
@@ -73,14 +66,14 @@ jobs:
|
||||
create_next_release_branch_grafana:
|
||||
name: Create next release branch (Grafana)
|
||||
needs: setup
|
||||
uses: ./.github/workflows/create-next-release-branch.yml
|
||||
uses: grafana/grafana/.github/workflows/create-next-release-branch.yml@main
|
||||
with:
|
||||
ownerRepo: 'grafana/grafana'
|
||||
source: ${{ needs.setup.outputs.release_branch }}
|
||||
create_next_release_branch_enterprise:
|
||||
name: Create next release branch (Grafana Enterprise)
|
||||
needs: setup
|
||||
uses: ./.github/workflows/create-next-release-branch.yml
|
||||
uses: grafana/grafana/.github/workflows/create-next-release-branch.yml@main
|
||||
with:
|
||||
ownerRepo: 'grafana/grafana-enterprise'
|
||||
source: ${{ needs.setup.outputs.release_branch }}
|
||||
@@ -88,7 +81,7 @@ jobs:
|
||||
needs:
|
||||
- setup
|
||||
- create_next_release_branch_grafana
|
||||
uses: ./.github/workflows/migrate-prs.yml
|
||||
uses: grafana/grafana/.github/workflows/migrate-prs.yml@main
|
||||
with:
|
||||
ownerRepo: 'grafana/grafana'
|
||||
from: ${{ needs.setup.outputs.release_branch }}
|
||||
@@ -97,14 +90,14 @@ jobs:
|
||||
needs:
|
||||
- setup
|
||||
- create_next_release_branch_enterprise
|
||||
uses: ./.github/workflows/migrate-prs.yml
|
||||
uses: grafana/grafana/.github/workflows/migrate-prs.yml@main
|
||||
with:
|
||||
ownerRepo: 'grafana/grafana-enterprise'
|
||||
from: ${{ needs.setup.outputs.release_branch }}
|
||||
to: ${{ needs.create_next_release_branch_enterprise.outputs.branch }}
|
||||
post_changelog_on_forum:
|
||||
needs: setup
|
||||
uses: ./.github/workflows/community-release.yml
|
||||
uses: grafana/grafana/.github/workflows/community-release.yml@main
|
||||
with:
|
||||
version: ${{ needs.setup.outputs.version }}
|
||||
dry_run: ${{ needs.setup.outputs.dry_run == 'true' }}
|
||||
@@ -113,7 +106,7 @@ jobs:
|
||||
# The github-release action retrieves the changelog using the /repos/grafana/grafana/contents/CHANGELOG.md API
|
||||
# endpoint.
|
||||
needs: setup
|
||||
uses: ./.github/workflows/github-release.yml
|
||||
uses: grafana/grafana/.github/workflows/github-release.yml@main
|
||||
with:
|
||||
version: ${{ needs.setup.outputs.version }}
|
||||
dry_run: ${{ needs.setup.outputs.dry_run == 'true' }}
|
||||
|
||||
@@ -16,10 +16,6 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
description: The version of Grafana that is being released (without the `v` prefix)`
|
||||
target:
|
||||
required: true
|
||||
type: string
|
||||
description: The release branch pattern (eg v9.5.x) that these changes are being merged into
|
||||
changelog:
|
||||
required: false
|
||||
type: boolean
|
||||
@@ -73,19 +69,28 @@ jobs:
|
||||
id: vault-secrets
|
||||
uses: grafana/shared-workflows/actions/get-vault-secrets@main
|
||||
with:
|
||||
# Secrets placed in the ci/data/repo/grafana/grafana/delivery-bot-app path in Vault
|
||||
repo_secrets: |
|
||||
GRAFANA_DELIVERY_BOT_APP_PEM=delivery-bot-app:PRIVATE_KEY
|
||||
- name: Generate token
|
||||
id: generate_changelog_token
|
||||
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
|
||||
with:
|
||||
app_id: ${{ vars.DELIVERY_BOT_APP_ID }}
|
||||
private_key: ${{ env.GRAFANA_DELIVERY_BOT_APP_PEM }}
|
||||
repositories: "[\"grafana\", \"grafana-enterprise\"]"
|
||||
permissions: "{\"contents\": \"write\", \"pull_requests\": \"write\", \"workflows\":\"write\"}"
|
||||
- run: echo "RELEASE_BRANCH=release-${VERSION}" >> "$GITHUB_ENV"
|
||||
- name: Checkout Grafana
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ steps.generate_changelog_token.outputs.token }}
|
||||
ref: ${{ env.RELEASE_BRANCH }}
|
||||
fetch-tags: true
|
||||
fetch-depth: 0
|
||||
- name: Checkout Grafana (main)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ steps.generate_changelog_token.outputs.token }}
|
||||
ref: main
|
||||
fetch-depth: '0'
|
||||
path: .grafana-main
|
||||
@@ -94,21 +99,17 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: Configure git user
|
||||
run: |
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "grafana-delivery-bot[bot]"
|
||||
git config --local user.email "grafana-delivery-bot[bot]@users.noreply.github.com"
|
||||
git config --local --add --bool push.autoSetupRemote true
|
||||
|
||||
- name: Create branch
|
||||
run: git checkout -b "release/${{ github.run_number }}/$VERSION"
|
||||
- name: Generate changelog token
|
||||
if: ${{ inputs.changelog == true || inputs.changelog == 'true' }}
|
||||
id: generate_changelog_token
|
||||
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
|
||||
with:
|
||||
app_id: ${{ vars.DELIVERY_BOT_APP_ID }}
|
||||
private_key: ${{ env.GRAFANA_DELIVERY_BOT_APP_PEM }}
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
if: ${{ inputs.changelog == true || inputs.changelog == 'true' }}
|
||||
@@ -156,13 +157,16 @@ jobs:
|
||||
- name: Commit CHANGELOG.md changes
|
||||
if: ${{ inputs.changelog == true || inputs.changelog == 'true' }}
|
||||
run: git add CHANGELOG.md && git commit --allow-empty -m "Update changelog" CHANGELOG.md
|
||||
|
||||
- name: Update package.json versions
|
||||
- name: Bump versions
|
||||
if: ${{ inputs.bump == true || inputs.bump == 'true' }}
|
||||
uses: ./.grafana-main/pkg/build/actions/bump-version
|
||||
uses: dagger/dagger-for-github@e47aba410ef9bb9ed81a4d2a97df31061e5e842e
|
||||
with:
|
||||
version: 'patch'
|
||||
verb: run
|
||||
args: go run -C .grafana-main ./pkg/build/actions/bump-version -version="patch"
|
||||
|
||||
- name: make gen-cue
|
||||
shell: bash
|
||||
run: make gen-cue
|
||||
- name: Add package.json changes
|
||||
if: ${{ inputs.bump == true || inputs.bump == 'true' }}
|
||||
run: |
|
||||
@@ -171,14 +175,13 @@ jobs:
|
||||
git commit -m "Update version to $VERSION"
|
||||
|
||||
- name: Git push
|
||||
if: inputs.dry_run != true
|
||||
run: git push
|
||||
- name: Create PR
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: ${{ steps.branch.outputs.branch }}
|
||||
DRY_RUN: ${{ inputs.dry_run }}
|
||||
run: |
|
||||
LATEST_FLAG=""
|
||||
LATEST_FLAG=()
|
||||
if [ "$LATEST" = "true" ]; then
|
||||
LATEST_FLAG=(-l "release/latest")
|
||||
fi
|
||||
@@ -186,6 +189,6 @@ jobs:
|
||||
"${LATEST_FLAG[@]}" \
|
||||
-l "no-changelog" \
|
||||
--dry-run="$DRY_RUN" \
|
||||
-B "$BRANCH" \
|
||||
-B "${RELEASE_BRANCH}" \
|
||||
--title "Release: $VERSION" \
|
||||
--body "These code changes must be merged after a release is complete"
|
||||
|
||||
Reference in New Issue
Block a user