go-latestver/.github/workflows/test-and-build.yml
Knut Ahlers 38f0348884
Add Helm Chart
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-04-16 18:04:42 +02:00

106 lines
1.9 KiB
YAML

---
name: test-and-build
on:
push:
branches: ['*']
tags: ['v*']
permissions:
contents: write
jobs:
test-and-build:
defaults:
run:
shell: bash
container:
image: luzifer/gh-arch-env
env:
CGO_ENABLED: 0
GOPATH: /go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Marking workdir safe
run: git config --global --add safe.directory /__w/go-latestver/go-latestver
- name: Lint and test code
run: |
make go_test helm_lint
helm-publish:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs:
- test-and-build
defaults:
run:
shell: bash
container:
image: luzifer/gh-arch-env
env:
CGO_ENABLED: 0
GOPATH: /go
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Log into registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Package Helm Chart
run: |
helm package charts/latestver
helm push latestver-*.tgz oci://ghcr.io/luzifer
docker-publish:
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master' }}
needs:
- test-and-build
defaults:
run:
shell: bash
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Log into registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Build & Publish
run: bash ci/docker-publish.sh
...