Skip to content

Merge pull request #517 from zoetrope/renovate/patch-kubernetes-go #32

Merge pull request #517 from zoetrope/renovate/patch-kubernetes-go

Merge pull request #517 from zoetrope/renovate/patch-kubernetes-go #32

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: GHCR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: aquaproj/aqua-installer@6ce1f8848ec8e61f14d57bd5d7597057a6dd187c # v3.0.1
with:
aqua_version: v2.29.0
aqua_opts: ""
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set previous release tag for GoReleaser
run: |
export TAG=$(curl -s "https://api.github.com/repos/zoetrope/website-operator/releases/latest" | jq -r .tag_name)
echo "GORELEASER_PREVIOUS_TAG=${TAG}" >> $GITHUB_ENV
- name: GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
chart-release:
runs-on: ubuntu-22.04
needs: release
if: contains(needs.release.result, 'success')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set chart version
run: |
helm repo add website-operator https://zoetrope.github.io/website-operator
helm repo update
# get the release tag version
tag_version=${GITHUB_REF##*/v}
# get the latest chart version
chart_version=$(helm search repo website-operator -o json | jq -r 'sort_by(.version) | .[-1].version')
chart_patch_version=${chart_version##*.}
new_patch_version=$(($chart_patch_version+1))
# if minor or major version changed, reset new patch version
local_version=$(cat charts/website-operator/Chart.yaml | yq .version | sed "s/0-chart-patch-version-placeholder/$chart_patch_version/g")
[ "$local_version" != "$chart_version" ] && new_patch_version=0
# replace placeholder with new version
sed --in-place "s/app-version-placeholder/$tag_version/g" charts/website-operator/Chart.yaml
sed --in-place "s/0-chart-patch-version-placeholder/$new_patch_version/g" charts/website-operator/Chart.yaml
sed --in-place "s/app-version-placeholder/$tag_version/g" charts/website-operator/values.yaml
- name: Create release notes
run: |
tag_version=${GITHUB_REF##*/}
cat <<EOF > ./charts/website-operator/RELEASE.md
Helm chart for Website Operator [$tag_version](https://github.com/zoetrope/website-operator/releases/tag/$tag_version)
EOF
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v4
- name: Run chart-releaser
uses: helm/[email protected]
with:
config: cr.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"