Skip to content

Bump dependencies to fix Dependabot alert. #64

Bump dependencies to fix Dependabot alert.

Bump dependencies to fix Dependabot alert. #64

Workflow file for this run

name: build
on:
push:
branches:
tags:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up go 1.20
uses: actions/setup-go@v3
with:
go-version: "1.20"
id: go
- name: Checkout
uses: actions/checkout@v3
- name: Build and test
run: |
go test -v -timeout=100s -covermode=count -coverprofile=$GITHUB_WORKSPACE/coverage.out ./...
env:
GOFLAGS: "-mod=vendor"
- name: Run linters
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.3
env:
TZ: "Etc/UTC"
- name: Install goveralls
run: |
GO111MODULE=off go get -u github.com/mattn/goveralls
- name: Submit coverage
run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/coverage.out
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Build and push master image to ghcr.io and Docker Hub
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_PKG: ${{ secrets.GUTHUB_CR_PAT }}
DOCKERHUB_USER: ${{ secrets.DOCKEHUB_USER }}
DOCKERHUB_PKG: ${{ secrets.DOCKEHUB_TOKEN }}
GITHUB_SHA: ${{ github.sha}}
GITHUB_REF: ${{ github.ref}}
run: |
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
sha="$(echo ${GITHUB_SHA} | cut -c1-7)"
echo REPO_BUILD_TAG: ${ref}-${sha}
echo ${GITHUB_PKG} | docker login ghcr.io -u ${GITHUB_USER} --password-stdin
echo ${DOCKERHUB_PKG} | docker login -u ${DOCKERHUB_USER} --password-stdin
docker buildx build --push \
--build-arg REPO_BUILD_TAG=${ref}-${sha} \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/${GITHUB_USER}/authlog_exporter:${ref} \
-t ${DOCKERHUB_USER}/authlog_exporter:${ref} .
- name: Build and push tag (latest) image to ghcr.io and Docker Hub
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_PKG: ${{ secrets.GUTHUB_CR_PAT }}
DOCKERHUB_USER: ${{ secrets.DOCKEHUB_USER }}
DOCKERHUB_PKG: ${{ secrets.DOCKEHUB_TOKEN }}
GITHUB_SHA: ${{ github.sha}}
GITHUB_REF: ${{ github.ref}}
run: |
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
echo REPO_BUILD_TAG: ${ref}
echo ${GITHUB_PKG} | docker login ghcr.io -u ${GITHUB_USER} --password-stdin
echo ${DOCKERHUB_PKG} | docker login -u ${DOCKERHUB_USER} --password-stdin
docker buildx build --push \
--build-arg REPO_BUILD_TAG=${ref} \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/${GITHUB_USER}/authlog_exporter:${ref} \
-t ghcr.io/${GITHUB_USER}/authlog_exporter:latest \
-t ${DOCKERHUB_USER}/authlog_exporter:${ref} \
-t ${DOCKERHUB_USER}/authlog_exporter:latest .
goreleaser:
needs: build
runs-on: ubuntu-latest
env:
goreleaser_version: "v1.20.0"
steps:
- name: Set up go 1.20
uses: actions/setup-go@v3
with:
go-version: "1.20"
id: go
- name: Checkout
uses: actions/checkout@v3
- name: Get ref
id: vars
run: |
echo ::set-output name=ref::$(echo ${GITHUB_REF} | cut -d'/' -f3)
- name: Check GoReleaser config
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: ${{ env.goreleaser_version }}
args: check .goreleaser.yml
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
with:
distribution: goreleaser
version: ${{ env.goreleaser_version }}
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}