forked from ccremer/kubernetes-zfs-provisioner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jp39
committed
Oct 19, 2024
1 parent
a13c885
commit 313dabb
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Check out repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get versions | ||
id: get_versions | ||
run: | | ||
echo GO_VERSION=$(go mod edit -json | grep -Po '"Go":\s+"([0-9.]+)"' | sed -E 's/.+"([0-9.]+)"/\1/') >> $GITHUB_ENV | ||
echo BUILD_VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_ENV | ||
echo CHART_VERSION=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV | ||
- name: Login to ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
target: image | ||
push: true | ||
tags: ghcr.io/jp39/zfs-provisioner:latest,ghcr.io/jp39/zfs-provisioner:${{ env.BUILD_VERSION }} | ||
build-args: | | ||
GO_VERSION=${{ .env.BUILD_VERSION }} | ||
- name: Update Helm image tag | ||
id: update_image | ||
uses: fjogeleit/yaml-update-action@master | ||
with: | ||
valueFile: "charts/zfs-provisioner/values.yaml" | ||
propertyPath: "image.tag" | ||
value: ${{ env.BUILD_VERSION }} | ||
message: "Update image tag to ${{ env.BUILD_VERSION }}" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: main | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
- name: Update Helm chart version | ||
uses: fjogeleit/yaml-update-action@master | ||
with: | ||
valueFile: "charts/zfs-provisioner/Chart.yaml" | ||
propertyPath: "version" | ||
value: ${{ env.CHART_VERSION }} | ||
message: "Update chart version to ${{ env.CHART_VERSION }}" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
updateFile: true | ||
branch: main | ||
|
||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.4.0 | ||
|
||
- name: Run chart-releaser | ||
uses: helm/[email protected] | ||
with: | ||
charts_dir: deploy | ||
env: | ||
CR_RELEASE_NAME_TEMPLATE: "{{ .Version }}" | ||
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} |