fix package-lock.json #30
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
release: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: GHCR Login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4 | |
with: | |
go-version-file: go.mod | |
- uses: aquaproj/aqua-installer@36dc5833b04eb63f06e3bb818aa6b7a6e6db99a9 # v2.1.2 | |
with: | |
aqua_version: v2.10.1 | |
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@v4 | |
with: | |
version: latest | |
args: release --rm-dist | |
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@v3 | |
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@v3 | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
with: | |
config: cr.yaml | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |