Skip to content

fix: github actions

fix: github actions #3

name: Build and Publish
on:
push:
branches:
- main
- dev
tags:
- v*.*.*
pull_request:
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository_owner }}/lagoon-restore-files-task
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Set build date
run: echo "BUILD_DATE=$(date +%FT%T%z)" >> $GITHUB_ENV
-
name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: build/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{github.ref_name}}
BUILD_DATE=${{ env.BUILD_DATE }}