mirror of
https://github.com/Luzifer/go-latestver.git
synced 2024-12-20 18:41:17 +00:00
106 lines
1.9 KiB
YAML
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
|
|
|
|
...
|