Skip to content

Commit

Permalink
Merge pull request #576 from yiannistri/573-release-v2.9
Browse files Browse the repository at this point in the history
[v2.9] ci: Add goreleaser config and update release workflow
  • Loading branch information
yiannistri authored Jul 4, 2024
2 parents 5fdc329 + efe0553 commit 4060ef7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 48 deletions.
38 changes: 0 additions & 38 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,6 @@ steps:
- pull_request
- tag

- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-amd64.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
ref:
- refs/head/master
- refs/tags/*
event:
- tag

- name: docker-publish
image: plugins/docker
settings:
Expand Down Expand Up @@ -92,25 +73,6 @@ steps:
- pull_request
- tag

- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm64.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
ref:
- refs/head/master
- refs/tags/*
event:
- tag

- name: docker-publish
image: plugins/docker
settings:
Expand Down
41 changes: 31 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ on:
# - PUBLIC_REGISTRY_USERNAME
# - PUBLIC_REGISTRY_PASSWORD

permissions:
contents: read

jobs:
publish-public:
release:
permissions:
contents: read
id-token: write
runs-on: ubuntu-22.04
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
Expand All @@ -44,15 +41,39 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name}}
- name: Build operator binary
run: |
make operator
- 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
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
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"
27 changes: 27 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 2

project_name: aks-operator

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64
binary: aks-operator

release:
prerelease: auto

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

0 comments on commit 4060ef7

Please sign in to comment.