Skip to content

Add .github/workflow/main.yml #6

Add .github/workflow/main.yml

Add .github/workflow/main.yml #6

Workflow file for this run

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.GO_VERSION }}"

Check failure on line 47 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / CI

Invalid workflow file

The workflow is not valid. .github/workflows/main.yml (Line: 47, Col: 23): Unexpected symbol: '.env.GO_VERSION'. Located at position 1 within expression: .env.GO_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 }}