Merge pull request #623 from mjura/workflow-v2.9 #35
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*' | |
# GitHub settings / example values: | |
# | |
# org level vars: | |
# - PUBLIC_REGISTRY: docker.io | |
# repo level vars: | |
# - PUBLIC_REGISTRY_REPO: rancher | |
# repo level secrets: | |
# - PUBLIC_REGISTRY_USERNAME | |
# - PUBLIC_REGISTRY_PASSWORD | |
jobs: | |
release: | |
permissions: | |
contents: write # required for creating GH release | |
id-token: write # required for reading vault secrets | |
runs-on: ubuntu-latest | |
steps: | |
- name: Read secrets | |
uses: rancher-eio/read-vault-secrets@main | |
with: | |
secrets: | | |
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials username | PUBLIC_REGISTRY_USERNAME ; | |
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials password | PUBLIC_REGISTRY_PASSWORD ; | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ vars.PUBLIC_REGISTRY }} | |
username: ${{ env.PUBLIC_REGISTRY_USERNAME }} | |
password: ${{ env.PUBLIC_REGISTRY_PASSWORD }} | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref_name}} | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- name: Build and push all image variations | |
run: | | |
make operator | |
make image-push | |
TAG="${TAG}-amd64" TARGET_PLATFORMS=linux/amd64 make image-push | |
TAG="${TAG}-arm64" TARGET_PLATFORMS=linux/arm64 make image-push | |
env: | |
TAG: ${{ github.ref_name }} | |
REPO: ${{ vars.PUBLIC_REGISTRY }}/${{ vars.PUBLIC_REGISTRY_REPO }} | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required for creating GH release | |
GORELEASER_CURRENT_TAG: ${{ github.ref_name }} # specify the tag to be released | |
id: goreleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: "~> v2" | |
args: release --clean --verbose | |
- name: Upload charts to release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required for updating GH release | |
REPO: rancher/aks-operator # Docker repository to reference in `values.yaml` of the Helm chart release | |
TAG: ${{ github.ref_name }} # image tag to be referenced in `values.yaml` of the Helm chart release | |
run: | | |
version=$(echo '${{ steps.goreleaser.outputs.metadata }}' | jq -r '.version') | |
echo "Publishing helm charts (version: $version)" | |
# Both version and appVersion are set to the same value in the Chart.yaml (excluding the 'v' prefix) | |
CHART_VERSION=$version GIT_TAG=$version make charts | |
for f in $(find bin/ -name '*.tgz'); do | |
echo "Uploading $f to GitHub release $TAG" | |
gh release upload $TAG $f | |
done | |
echo "Charts successfully uploaded to GitHub release $TAG" |