mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-31 18:17:24 +01:00
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1 to v1.0.7. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Commits](https://github.com/codecov/codecov-action/compare/v1...f532c3a1452359a7f96c37efc741537b80555c74) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
148 lines
4.6 KiB
YAML
148 lines
4.6 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
- 'v*'
|
|
tags:
|
|
- 'v*'
|
|
paths-ignore:
|
|
- '**.md'
|
|
- '.github/workflows/docs.yml'
|
|
- 'docs/**'
|
|
- 'Dockerfile.mkdocs'
|
|
- 'mkdocs.yml'
|
|
pull_request:
|
|
branches:
|
|
- 'master'
|
|
- 'v*'
|
|
paths-ignore:
|
|
- '**.md'
|
|
- '.github/workflows/docs.yml'
|
|
- 'docs/**'
|
|
- 'Dockerfile.mkdocs'
|
|
- 'mkdocs.yml'
|
|
|
|
jobs:
|
|
|
|
go:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Prepare
|
|
id: prepare
|
|
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 ./...
|
|
-
|
|
name: Upload coverage
|
|
uses: codecov/codecov-action@v1.0.7
|
|
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.prepare.outputs.tag_name }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
needs: go
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Prepare
|
|
id: prepare
|
|
run: |
|
|
DOCKER_USERNAME=crazymax
|
|
DOCKER_IMAGE=crazymax/diun
|
|
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
|
|
VERSION=edge
|
|
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
VERSION=${GITHUB_REF#refs/tags/v}
|
|
fi
|
|
|
|
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
|
|
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
|
TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest"
|
|
fi
|
|
|
|
echo ::set-output name=docker_username::${DOCKER_USERNAME}
|
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
|
echo ::set-output name=version::${VERSION}
|
|
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
|
--build-arg VERSION=${VERSION} \
|
|
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
|
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
|
${TAGS} --file Dockerfile .
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: crazy-max/ghaction-docker-buildx@v3.1.0
|
|
-
|
|
name: Docker Buildx (build)
|
|
run: |
|
|
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
|
|
-
|
|
name: Docker Login
|
|
if: success() && github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
|
|
env:
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
run: |
|
|
echo "${DOCKER_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin
|
|
-
|
|
name: Docker Buildx (push)
|
|
if: success() && github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
|
|
run: |
|
|
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
|
-
|
|
name: Docker Check Manifest
|
|
if: success() && github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
|
|
run: |
|
|
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
|
-
|
|
name: Clear
|
|
if: always() && github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
|
|
run: |
|
|
rm -f ${HOME}/.docker/config.json
|