build(deps): bump docker/build-push-action from 4 to 5 #556
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go package | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19 | |
- name: Update dependencies | |
run: go get ./... | |
- name: Install golint | |
run: sudo apt-get install -y golint | |
- name: Install and Run Pre-commit | |
uses: pre-commit/[email protected] | |
- name: Build | |
run: go build -tags=plugins -v ./... | |
- name: Test | |
run: go test -tags=plugins -v ./... | |
- uses: docker/setup-buildx-action@v2 | |
- name: Prepare docker build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# shellcheck disable=SC2086 | |
git config user.name "GitHub Actions Bot" | |
# shellcheck disable=SC2086 | |
git config user.email "<>" | |
# shellcheck disable=SC2086 | |
echo "${GITHUB_TOKEN}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
# shellcheck disable=SC2086 | |
echo "DESCRIBE=$(git describe)" >> $GITHUB_ENV | |
if [ "$GITHUB_REF_TYPE" == "tag" ]; then | |
# shellcheck disable=SC2086 | |
echo "TAGS=ghcr.io/bolt-observer/agent:$GITHUB_REF_NAME,ghcr.io/bolt-observer/agent:unstable" >> $GITHUB_ENV | |
elif [ "$GITHUB_REF_NAME" == "main" ]; then | |
# shellcheck disable=SC2086 | |
echo "TAGS=ghcr.io/bolt-observer/agent:$GITHUB_REF_NAME,ghcr.io/bolt-observer/agent:latest,ghcr.io/bolt-observer/agent:unstable" >> $GITHUB_ENV | |
else | |
# shellcheck disable=SC2086 | |
echo "TAGS=ghcr.io/bolt-observer/agent:unstable" >> $GITHUB_ENV | |
fi | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ env.TAGS }} | |
cache-from: type=gha,scope=${{ env.GITHUB_REF_NAME }}-agent | |
cache-to: type=gha,mode=max,scope=${{ env.GITHUB_REF_NAME }}-agent | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
DESCRIBE=${{ env.DESCRIBE }} |