mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-31 18:17:24 +01:00
Bumps [docker/login-action](https://github.com/docker/login-action) from v1.4.0 to v1.4.1. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v1.4.0...34d5f75b0d6d0d22f06d83acf2fa1b144409ec83) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
147 lines
4.4 KiB
YAML
147 lines
4.4 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
- 'v*'
|
|
tags:
|
|
- 'v*'
|
|
paths-ignore:
|
|
- '**.md'
|
|
- '.github/workflows/docs.yml'
|
|
- 'docs/**'
|
|
- 'mkdocs.yml'
|
|
pull_request:
|
|
branches:
|
|
- 'master'
|
|
- 'v*'
|
|
paths-ignore:
|
|
- '**.md'
|
|
- '.github/workflows/docs.yml'
|
|
- 'docs/**'
|
|
- 'mkdocs.yml'
|
|
|
|
jobs:
|
|
|
|
go:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2.3.3
|
|
-
|
|
name: Prepare
|
|
id: prep
|
|
run: |
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
echo ::set-output name=tag_name::${GITHUB_REF#refs/tags/}
|
|
fi
|
|
-
|
|
name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.13
|
|
-
|
|
name: Cache Go modules
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
-
|
|
name: GoReleaser
|
|
uses: goreleaser/goreleaser-action@v2
|
|
with:
|
|
version: latest
|
|
args: release --skip-publish --rm-dist
|
|
-
|
|
name: Test
|
|
run: |
|
|
go test -coverprofile=coverage.txt -covermode=atomic -race ./...
|
|
-
|
|
name: Upload coverage
|
|
uses: codecov/codecov-action@v1.0.13
|
|
if: success()
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
file: ./coverage.txt
|
|
-
|
|
name: GitHub Release
|
|
uses: softprops/action-gh-release@v1
|
|
if: success() && startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
draft: true
|
|
files: |
|
|
dist/checksums.txt
|
|
dist/*.tar.gz
|
|
dist/*.zip
|
|
name: ${{ steps.prep.outputs.tag_name }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
needs: go
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2.3.3
|
|
-
|
|
name: Prepare
|
|
id: prep
|
|
run: |
|
|
DOCKER_IMAGE=crazymax/diun
|
|
VERSION=edge
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
VERSION=${GITHUB_REF#refs/tags/v}
|
|
fi
|
|
TAGS="${DOCKER_IMAGE}:${VERSION}"
|
|
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
|
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
|
|
fi
|
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
|
echo ::set-output name=version::${VERSION}
|
|
echo ::set-output name=tags::${TAGS}
|
|
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
|
echo ::set-output name=vcs_ref::${GITHUB_SHA::8}
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
with:
|
|
buildkitd-flags: "--debug"
|
|
-
|
|
name: Login to DockerHub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v1.4.1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
-
|
|
name: Build
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
|
|
push: ${{ github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/')) }}
|
|
tags: ${{ steps.prep.outputs.tags }}
|
|
build-args: |
|
|
VERSION=${{ steps.prep.outputs.version }}
|
|
BUILD_DATE=${{ steps.prep.outputs.build_date }}
|
|
VCS_REF=${{ steps.prep.outputs.vcs_ref }}
|
|
-
|
|
name: Check manifest
|
|
if: github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
|
|
run: |
|
|
docker buildx imagetools inspect ${{ steps.prep.outputs.docker_image }}:${{ steps.prep.outputs.version }}
|
|
-
|
|
name: Check pull
|
|
if: github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
|
|
run: |
|
|
docker pull ${{ steps.prep.outputs.docker_image }}:${{ steps.prep.outputs.version }}
|