This commit is contained in:
parent
8ac3eef33a
commit
67f07b7601
|
@ -0,0 +1,32 @@
|
|||
name: Go
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "1.21"
|
||||
cache: false
|
||||
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: v1.54
|
||||
|
||||
- name: build
|
||||
run: make build
|
||||
|
||||
- name: test
|
||||
run: make test
|
|
@ -1,19 +1,16 @@
|
|||
name: Build
|
||||
|
||||
name: Release
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
tags:
|
||||
- "v*"
|
||||
pull_request:
|
||||
branches:
|
||||
- "main"
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
jobs:
|
||||
build:
|
||||
buildpush:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- # Get the repository's code
|
||||
name: Checkout
|
||||
|
@ -55,7 +52,7 @@ jobs:
|
|||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
- # httos://github.com/actions/cache
|
||||
name: Configure cache
|
||||
name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
|
@ -63,9 +60,9 @@ jobs:
|
|||
/tmp/.npm-cache
|
||||
/tmp/.go-build-cache
|
||||
/tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-build-
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-buildx-
|
||||
- # https://github.com/docker/build-push-action
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
|
@ -78,12 +75,11 @@ jobs:
|
|||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
# cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
|
||||
cache-to: type=local,dest=/tmp/.build-cache/buildx-new,mode=max
|
||||
- # "Temp" fix
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||
- # Temp fix
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.build-cache/buildx
|
||||
mv /tmp/.build-cache/buildx-new /tmp/.build-cache/buildx
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
Loading…
Reference in New Issue
Block a user