2023-03-18 16:41:16 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
name: test-and-build
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: ['*']
|
|
|
|
tags: ['v*']
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test-and-build:
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
container:
|
2024-04-16 11:09:55 +00:00
|
|
|
image: luzifer/gh-arch-env
|
2023-03-18 16:41:16 +00:00
|
|
|
env:
|
|
|
|
CGO_ENABLED: 1
|
|
|
|
GOPATH: /go
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Install required packages
|
|
|
|
run: |
|
|
|
|
pacman -Syy --noconfirm \
|
2024-04-16 11:09:55 +00:00
|
|
|
base-devel
|
2023-03-18 16:41:16 +00:00
|
|
|
|
2024-04-16 11:09:55 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
show-progress: false
|
2023-03-18 16:41:16 +00:00
|
|
|
|
|
|
|
- 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
|
|
|
|
|
2024-04-16 11:09:55 +00:00
|
|
|
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
|
|
|
|
|
2023-03-18 16:41:16 +00:00
|
|
|
...
|