48 lines
No EOL
1.4 KiB
YAML
48 lines
No EOL
1.4 KiB
YAML
name: CI
|
|
env:
|
|
GO_VERSION: 1.19.x
|
|
on:
|
|
push:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- name: Get go version
|
|
id: go-version
|
|
run: echo "::set-output name=version::$(go env GOVERSION)"
|
|
- name: Docker Login
|
|
env:
|
|
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
run: |
|
|
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
|
- uses: actions/cache@v2
|
|
with:
|
|
# In order:
|
|
# * Module download cache
|
|
# * Build cache (Linux)
|
|
# * Build cache (Mac)
|
|
# * Build cache (Windows)
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/.cache/go-build
|
|
~/Library/Caches/go-build
|
|
%LocalAppData%\go-build
|
|
key: ${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ steps.go-version.outputs.version }}-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ env.CACHE_VERSION }}-${{ runner.os }}-go
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v2
|
|
with:
|
|
version: latest
|
|
args: release --rm-dist
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} |