Skip to content

fix github actions group #38

fix github actions group

fix github actions group #38

name: Docker build and push
on:
push:
branches:
- 'main'
env:
IMAGE_NAME: larmic/golang-starter-example
# cancel jobs in current pr if new commit is done
concurrency:
group: `${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}`

Check failure on line 13 in .github/workflows/docker-build-and-push.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/docker-build-and-push.yml

Invalid workflow file

You have an error in your yaml syntax on line 13
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up version # will be read by Dockerfile to set version in open-api-3.yaml
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: prepare buildx
run: |
# Use docker-container driver to allow useful features (push/multi-platform)
docker buildx create --driver docker-container --use
docker buildx inspect --bootstrap
- name: build image
run: |
update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm --build-arg VERSION=$VERSION --pull --tag "$IMAGE_NAME:$VERSION" --tag "$IMAGE_NAME:latest" . --push