-
Notifications
You must be signed in to change notification settings - Fork 157
145 lines (131 loc) · 6.23 KB
/
prepare-release.yaml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: prepare-release
on:
workflow_dispatch:
inputs:
version:
description: "Version (e.g. 'v1.2.3-rc.4')"
required: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: weaveworks/wego-app
jobs:
release-tasks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow
run: |
git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.X
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.X
- name: Set up environment vars
run: |
echo "BRANCH=releases/${{ github.event.inputs.version }}" >> $GITHUB_ENV
GITOPS_VERSION=$(echo ${{ github.event.inputs.version }} | tr -d v)
echo "GITOPS_VERSION=$GITOPS_VERSION" >> $GITHUB_ENV
git config user.name weave-gitops-bot
git config user.email [email protected]
- name: Update npm package version
run: |
jq '.version = "'$GITOPS_VERSION'"' < package.json > package-new.json
mv package-new.json package.json
yarn
yarn test -- -u
git commit -am "Update javascript library version to $GITOPS_VERSION"
- name: Update Chart
run: |
# Increment the micro chart version
NEW_CHART_VERSION=$(yq e '.version' charts/gitops-server/Chart.yaml | awk -F. -v OFS=. '{ $3++; print }')
yq e '.appVersion = "${{ github.event.inputs.version }}"' -i charts/gitops-server/Chart.yaml
yq e '.version = "'$NEW_CHART_VERSION'"' -i charts/gitops-server/Chart.yaml
yq e '.image.tag = "${{ github.event.inputs.version }}"' -i charts/gitops-server/values.yaml
git commit -am "Update helm chart to $NEW_CHART_VERSION to use gitops $GITOPS_VERSION"
if: ${{ !contains(github.event.inputs.version, '-') }}
- name: Generate updated helm reference
# Needs to run after chart update, before docs update
run: |
go install github.com/norwoodj/helm-docs/cmd/[email protected]
helm-docs -c charts/gitops-server -o ../../website/docs/references/helm-reference.md
git commit -am "Update the helm reference" || : # This may not have changed
- name: Update docs version
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
GA_KEY: ${{ secrets.GA_KEY }}
run: |
VERSION=${{ github.event.inputs.version }} make bin/gitops
tools/update-docs.sh ${PWD}/bin/gitops ${PWD}/website
git add website
git commit -m "Update docs for release $GITOPS_VERSION"
if: ${{ !contains(github.event.inputs.version, '-') }}
- name: Update README
run: |
sed -i 's#\(weave-gitops/releases/download/\)[^/]\+\(/gitops-\)#\1${{ github.event.inputs.version }}\2#' README.md
git commit -am "Update README to point download link to $GITOPS_VERSION"
if: ${{ !contains(github.event.inputs.version, '-') }}
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3
with:
configuration: "${{ github.workspace }}/.github/changelog/changelog_configuration.json"
ignorePreReleases: true
toTag: ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Pull Request
id: create-pull-request
uses: peter-evans/create-pull-request@v4
with:
author: weave-gitops-bot <[email protected]>
signoff: true
committer: weave-gitops-bot <[email protected]>
branch: ${{ env.BRANCH }}
base: main
title: "Updates for ${{ env.GITOPS_VERSION }}"
body: |
## ⚠️ Breaking changes
Describe any breaking changes here, or delete this block
## ✍️ Action required
Describe any user facing actions here, or delete this block.
## 💸 Features and improvements
Describe any user facing changes here, or delete this block.
Examples of user facing changes:
- API changes
- Bug fixes
- Any changes in behaviour
- Changes requiring upgrade notices or deprecation warning
## Flux compatibility
| Flux version | Minimum required |
|--------------------|------------------|
| `v2.0` | `>= 2.0.0` |
For Flux migrations to v2.0 see [flux](https://github.com/fluxcd/flux2/releases/tag/v2.0.0) or [weave gitops](https://docs.gitops.weave.works/docs/guides/fluxga-upgrade/) documentation.
${{ steps.github_release.outputs.changelog }}
token: ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }}
labels: "exclude from release notes"
# 'Lock Release PR Merge' sets 'release' status check with pending state to avoid accidentally merging the release PR. See ../../doc/incidents/issues-3907 for full context.
- name: Lock Release PR
run: |
curl --fail --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ steps.create-pull-request.outputs.pull-request-head-sha }} \
--header 'authorization: Bearer ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"state":"pending",
"description":"execute the release to pass this check",
"context":"release"
}'
- name: "Comment on pull request"
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.create-pull-request.outputs.pull-request-number }}/comments \
--header 'authorization: Bearer ${{ secrets.WEAVE_GITOPS_BOT_ACCESS_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"body": "To change the release notes, edit the pull request description.\n\nAs soon as you approve the PR, the release will start, and will be automatically merged when finished"
}'