Skip to content

Commit

Permalink
Update release-drafter.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Weifeng Wang <[email protected]>

add pr label check

Signed-off-by: Weifeng Wang <[email protected]>

Update README.md

Update github workflow

Signed-off-by: Weifeng Wang <[email protected]>
  • Loading branch information
qclaogui committed Mar 28, 2024
1 parent 753cf91 commit c883cfd
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 123 deletions.
43 changes: 27 additions & 16 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
name-template: 'v$NEXT_MINOR_VERSION'
tag-template: 'v$NEXT_MINOR_VERSION'
version-template: '$COMPLETE'
prerelease-identifier: rc
categories:
- title: '💥 Breaking Changes'
collapse-after: 15
label: 'kind/breaking'
- title: '🚀 Features'
collapse-after: 15
labels:
- 'kind/feature'
- title: '🎯 Improvements'
collapse-after: 15
labels:
- 'kind/improvement'
- title: '🐛 Bug Fixes'
collapse-after: 15
labels:
- 'kind/bug'
- title: '🧰 Maintenance'
collapse-after: 15
labels:
- 'area/tech-debt'
- 'area/ci'
- 'kind/maintenance'
- title: '📝 Documentation'
collapse-after: 10
labels:
- 'area/docs'
- 'kind/docs'
- title: '⬆️ Dependencies'
collapse-after: 10
labels:
- 'dependencies'
collapse-after: 5

change-template: '- $TITLE (#$NUMBER)'
change-title-escapes: '\<*_&#@`' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-template: '$COMPLETE'
no-changes-template: 'This release contains minor changes and bugfixes.'
template: |
# Release v$NEXT_MINOR_VERSION
A simple command to run Grafana LGTMP Stack in Docker or Kubernetes.
## What's Changed
$CHANGES
Expand All @@ -58,21 +68,21 @@ footer: |
| Port-mapping | Component | Description |
| --- | --- | --- |
| `12345:12345` | [Grafana Agent][7] | Eexpose `12345` port so we can directly access `grafana-agent` inside container |
| `33100:3100` | [Loki][1] | Expose `33100` port so we can directly access `loki` inside container |
| `3000:3000` | [Grafana][2] | Expose `3000` port so we can directly access `grafana` inside container |
| `33200:3200` | [Tempo][3] | Expose `33200` port so we can directly access `tempo` inside container |
| `38080:8080` | [Mimir][4] | Expose `38080` port so we can directly access `mimir` inside container |
| `34040:4040` | [Pyroscope][5] | Expose `34040` port so we can directly access `pyroscope` inside container |
| `9001:9001` | [Minio][6] | Expose `9001` port so we can access `minio` console with `MINIO_ROOT_USER=lgtmp`, `MINIO_ROOT_PASSWORD=supersecret` |
| `12345:12345`, `4317`, `4318`, `6831` | [Grafana Agent][1] | Eexpose `12345` port so we can directly access `grafana-agent` inside container |
| `33100:3100` | [Loki][2] | Expose `33100` port so we can directly access `loki` inside container |
| `3000:3000`, `6060` | [Grafana][3] | Expose `3000` port so we can directly access `grafana` inside container |
| `33200:3200`, `4317`, `4318` | [Tempo][4] | Expose `33200` port so we can directly access `tempo` inside container |
| `38080:8080` | [Mimir][5] | Expose `38080` port so we can directly access `mimir` inside container |
| `34040:4040` | [Pyroscope][6] | Expose `34040` port so we can directly access `pyroscope` inside container |
| `9001:9001`, `9000` | [Minio][7] | Expose `9001` port so we can access `minio` console with `MINIO_ROOT_USER=lgtmp`, `MINIO_ROOT_PASSWORD=supersecret` |
[7]: https://github.com/grafana/agent
[1]: https://github.com/grafana/loki
[2]: https://github.com/grafana/grafana
[3]: https://github.com/grafana/tempo
[4]: https://github.com/grafana/mimir
[5]: https://github.com/grafana/pyroscope
[6]: https://github.com/minio/minio
[1]: https://github.com/grafana/agent
[2]: https://github.com/grafana/loki
[3]: https://github.com/grafana/grafana
[4]: https://github.com/grafana/tempo
[5]: https://github.com/grafana/mimir
[6]: https://github.com/grafana/pyroscope
[7]: https://github.com/minio/minio
## Helpful Links
Expand All @@ -83,3 +93,4 @@ footer: |
- <https://github.com/k3d-io/k3d>
- <https://github.com/k3s-io/k3s>
- <https://github.com/grafana/grafana>
- [Grafana Agent Configuration Generator](https://github.com/grafana/agent-configurator) a tool allows for easy configuration of Grafana Agents Flow system
19 changes: 19 additions & 0 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check PR labels

on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize]

jobs:
enforce-kind:
name: Enforce a valid PR category
runs-on: ubuntu-latest
steps:
- name: Check if a valid PR category is present
env:
LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
run: |
if ! jq --exit-status 'any(test("kind/feature") or test("kind/docs") or test("kind/improvement") or test("kind/bug") or test("kind/maintenance") or test("dependencies") or test("skip-release-notes") or test("area/tech-debt"))' >/dev/null <<< $LABELS; then
echo "::error ::Please set either kind/feature, kind/docs, kind/improvement, kind/bug, kind/maintenance, dependencies, skip-release-notes or area/tech-debt as label"
exit 1
fi
28 changes: 8 additions & 20 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: GoReleaser Release
name: GoReleaser Publish Release

on:
workflow_call:
inputs:
isReleaseCandidate:
isPreRelease:
required: true
type: boolean
secrets:
Expand All @@ -14,38 +14,26 @@ env:
GORELEASER_VERSION: '1.24.0'

jobs:

publish-release:
name: ${{ inputs.isReleaseCandidate && 'prerelease' || 'release' }}
publish_release:
name: ${{ inputs.isPreRelease && 'prerelease' || 'release' }} publishing
runs-on: ubuntu-latest
steps:
- name: Free up disk space
run: |
echo "Available storage:"
df -h && echo
sudo docker image prune --all --force
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
echo "Available storage:"
df -h
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Install GoReleaser
run: |
wget -q https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_Linux_x86_64.tar.gz
tar -xzf goreleaser_Linux_x86_64.tar.gz
mv goreleaser /home/runner/go/bin/goreleaser-v${GORELEASER_VERSION}
- name: GoReleaser Release
if: ${{ !inputs.isReleaseCandidate }}
- if: ${{ !inputs.isPreRelease }}
run: ./tools/scripts/do-release.sh
env:
GITHUB_TOKEN: ${{ secrets.ghPAT }}
run: ./tools/scripts/do-release.sh

- name: GoReleaser Release Candidate
if: ${{ inputs.isReleaseCandidate }}
- if: ${{ inputs.isPreRelease }}
run: ./tools/scripts/do-release-candidate.sh
env:
GITHUB_TOKEN: ${{ secrets.ghPAT }}
run: ./tools/scripts/do-release-candidate.sh
29 changes: 13 additions & 16 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
name: Release Drafter

# this workflow will run when someone labeled a pull request that targets branch is main
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main

permissions:
contents: read
workflow_dispatch: {}

jobs:
update_release_draft:
name: Trigger a draft release update
permissions:
# write permission is required to create a github release
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v6
id: draft
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.QCBOT_TOKEN }}
with:
commitish: main
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- name: Copy release notes from Draft
run: |
tag_name=${{ steps.draft.outputs.tag_name }}
echo "${{ steps.draft.outputs.body }}" > docs/release_notes/${tag_name:1}.md
- name: Upsert pull request
- name: Upsert Pull Request
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e #v6.0.2
with:
token: ${{ secrets.QCBOT_TOKEN }}
title: Add release notes for ${{ steps.draft.outputs.tag_name }}
commit-message: Add release notes for ${{ steps.draft.outputs.tag_name }}
committer: 🤖GitHub Actions[Bot] <41898282+github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
signoff: true
# author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
assignees: qclaogui
# reviewers: qclaogui
body: |
🤖 Copy release notes from Draft
Expand All @@ -56,8 +53,8 @@ jobs:
</details>
<br />
> Auto-generated by [Release Drafter GitHub Action][1]
> Auto-generated by [Release Drafter GitHub Action][0]
[1]: https://github.com/qclaogui/codelab-monitoring/blob/main/.github/workflows/release-drafter.yml
labels: kind/improvement, skip-release-notes
[0]: https://github.com/qclaogui/codelab-monitoring/blob/main/.github/workflows/release-drafter.yml
labels: kind/docs, skip-release-notes
branch: update-release-notes
16 changes: 9 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Release start publishing
name: Release

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

jobs:
check-release-tag:
check_tag:
name: Parse the pushed tag version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
Expand All @@ -22,12 +23,13 @@ jobs:
;;
esac
outputs:
isRc: ${{ steps.vars.outputs.isRc }}
publish:
name: start publishing
isPreRelease: ${{ steps.vars.outputs.isRc }}

update_release:
name: Trigger a release update
uses: ./.github/workflows/publish-release.yml
needs: [check-release-tag]
needs: [check_tag]
with:
isReleaseCandidate: ${{ needs.check-release-tag.outputs.isRc == 'true' }}
isPreRelease: ${{ needs.check_tag.outputs.isPreRelease == 'true' }}
secrets:
ghPAT: ${{ secrets.QCBOT_TOKEN }}
25 changes: 0 additions & 25 deletions .github/workflows/trigger-release-candidate.yml

This file was deleted.

23 changes: 16 additions & 7 deletions .github/workflows/trigger-release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
name: Trigger Release
name: Trigger Release (Manually)

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
on:
workflow_dispatch: {}
workflow_dispatch:
inputs:
release:
description: 'Push tag and open PR to default branch'
required: true
default: 'prepare-release-candidate'
type: choice
options:
- prepare-release
- prepare-release-candidate

jobs:
rc:
name: Push release tag
prepare_release:
name: Trigger a ${{ inputs.release }} job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
Expand All @@ -16,10 +26,9 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Setup identity
uses: ./.github/actions/setup-identity
with:
token: ${{ secrets.QCBOT_TOKEN }}
- name: Push tag and open PR to default branch
run: make prepare-release

- run: make ${{ inputs.release }}
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,7 @@ delete-microservices-mode-traces: delete-memcached

##@ Grafana Agent Integrations

.PHONY: deploy-memcached
deploy-memcached: deploy-grafana ## Deploy integration memcached manifests
deploy-memcached: deploy-grafana
$(info ******************** deploy integration memcached manifests ********************)
@$(KUSTOMIZE) build --enable-helm kubernetes/common/memcached | kubectl apply -f -
delete-memcached: delete-minio
Expand Down
Loading

0 comments on commit c883cfd

Please sign in to comment.