forked from kubernetes/kube-state-metrics
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (86 loc) · 3.08 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Run on tag push.
# Note: Additionally, create the release branch.
on:
push:
tags:
- v*
permissions:
contents: read
env:
GO_VERSION_MATRIX: '"go-version": [ "^1.21", "latest" ]"'
GOLANGCI_LINT_VERSION: "v1.54.2"
E2E_SETUP_KIND: yes
E2E_SETUP_KUBECTL: yes
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: echo "::set-output name=matrix::${{ env.GO_VERSION_MATRIX }}"
release:
needs: setup
strategy:
matrix: ${{fromJson(needs.setup.outputs.matrix)}}
runs-on: ubuntu-latest
steps:
- name: Checkout into the repository in a new branch
uses: actions/checkout@v4
with:
ref: release-${{ github.ref }}
repository: ${{ github.event.repository.full_name }}
- name: Set up the Go@${{ matrix.go-version }} environment
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install tools
run: make install-tools
- name: Get the pushed tag
id: get_tag
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Update the VERSION manifest to the pushed tag
run: echo "${{ steps.get_tag.outputs.tag }}" > VERSION
- name: Update the compatibility matrix (README.md)
run: ./scripts/update-compatibility-matrix.sh
- name: Generate the release notes (CHANGELOG.md)
run: ./scripts/generate-release-notes.sh
- name: Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
sh -s -- -b $(go env GOPATH)/bin ${{ env.GOLANGCI_LINT_VERSION }}
make lint-fix
- name: Generate manifests
run: make examples
- name: Validate manifests
run: make validate-manifests
- name: Validate docs
run: make validate-docs
- name: Validate go modules
run: make validate-modules
- name: Run rule tests
run: PROMTOOL_CLI=./promtool make install-promtool test-rules
- name: Run unit tests
run: make test-unit
- name: Benchmark tests
run: make test-benchmark-compare
- name: Run end-to-end tests
run: make e2e
- name: Commit the changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "KSM Release Bot"
git add .
git commit -m "chore: Cut ${{ steps.get_tag.outputs.tag }}"
- name: Create a pull request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: Cut ${{ steps.get_tag.outputs.tag }}"
title: "chore: Cut ${{ steps.get_tag.outputs.tag }}"
body: "This PR was automatically created by the release workflow."
branch: release-${{ steps.get_tag.outputs.tag }}
base: release-${{ steps.get_tag.outputs.tag }}
reviewers: "sig-instrumentation-approvers"
assignees: "sig-instrumentation-leads"
draft: false