mirror of https://github.com/kha7iq/pingme
parent
40eb18442c
commit
76a8a00329
@ -1,29 +1,71 @@
|
|||||||
name: goreleaser
|
name: build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
release-pingme:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2.3.4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.16
|
go-version: '1.16'
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Cache Go modules
|
||||||
uses: goreleaser/goreleaser-action@v2
|
uses: actions/cache@v2.1.5
|
||||||
with:
|
with:
|
||||||
version: latest
|
path: ~/go/pkg/mod
|
||||||
args: release --rm-dist
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
-
|
||||||
|
name: Check
|
||||||
|
run: |
|
||||||
|
./goreleaser check
|
||||||
|
-
|
||||||
|
name: Diff
|
||||||
|
run: git diff
|
||||||
|
-
|
||||||
|
name: Docker Login
|
||||||
|
if: success() && startsWith(github.ref, 'refs/tags/v')
|
||||||
env:
|
env:
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
||||||
|
echo "${GITHUB_TOKEN}" | docker login ghcr.io --username $GITHUB_ACTOR --password-stdin
|
||||||
|
-
|
||||||
|
name: GoReleaser
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == refs/tags/v* ]]; then
|
||||||
|
./goreleaser
|
||||||
|
elif [[ $GITHUB_REF == refs/heads/master ]]; then
|
||||||
|
./goreleaser --snapshot
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
name: Clear
|
||||||
|
if: always() && startsWith(github.ref, 'refs/tags/v')
|
||||||
|
run: |
|
||||||
|
rm -f ${HOME}/.docker/config.json
|
Loading…
Reference in new issue