Skip to content

prepare-release

prepare-release #107

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 weave-gitops-bot@weave.works
- 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/helm-docs@v1.9.1
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 <weave-gitops-bot@weave.works>
signoff: true
committer: weave-gitops-bot <weave-gitops-bot@weave.works>
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"
}'