Skip to content

chore(deps): bump docker/build-push-action from 5 to 6 #88

chore(deps): bump docker/build-push-action from 5 to 6

chore(deps): bump docker/build-push-action from 5 to 6 #88

Workflow file for this run

name: "Build and push image"
# run workflow on every branch, only upload on main (allow manual trigger)
on:
# build image on push
push:
# don't build if only docs changed
paths-ignore:
- "**.md"
pull_request:
workflow_dispatch:
jobs:
build-push:
# only push branch main to registry
name: "Build and push image"
# use ubuntu as runner
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup yq
uses: mikefarah/yq@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
with:
registry: ghcr.io
username: z0rrn
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v3
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
with:
username: zorrn
password: ${{ secrets.DOCKER_TOKEN }}
- name: Set outputs for later use
id: set-op
run: |
# extract version from ./values.yml
echo "software-version=$(yq '.version.software-version' ./anki-sync-server/values.yml)" \
>> $GITHUB_OUTPUT
# get current date+time
echo "time=$(date --utc +'%FT%TZ')" >> $GITHUB_OUTPUT
# get current date+time docker tag compatible
echo "time-docker=$(date --utc +'%Y-%m-%dt%H-%M-%Sz')" >> $GITHUB_OUTPUT
- name: Build and push image in production
uses: docker/build-push-action@v6
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
with:
# directly push image
push: true
# use local repository
context: .
# which containerfile to build from
file: |
./anki-sync-server/containerfile
# build args to pass to the build
build-args: |
software_version=${{ steps.set-op.outputs.software-version }}
# build for many platforms at the same time
platforms: |
linux/amd64
linux/arm64
# set labels to append to the image
labels: |
org.opencontainers.image.created=${{ steps.set-op.outputs.time }}
org.opencontainers.image.version=${{ steps.set-op.outputs.software-version }}
# tags to build the image with
tags: |
ghcr.io/z0rrn/anki-sync-server:latest
ghcr.io/z0rrn/anki-sync-server:${{ steps.set-op.outputs.software-version }}
ghcr.io/z0rrn/anki-sync-server:${{ steps.set-op.outputs.time-docker }}
docker.io/zorrn/anki-sync-server:latest
docker.io/zorrn/anki-sync-server:${{ steps.set-op.outputs.software-version }}
docker.io/zorrn/anki-sync-server:${{ steps.set-op.outputs.time-docker }}
- name: Build image in testing only
uses: docker/build-push-action@v6
if: github.event_name == 'pull_request'
with:
# do not push image
push: false
# use local repository
context: .
# which containerfile to build from
file: |
./anki-sync-server/containerfile
# build args to pass to the build
build-args: |
software_version=${{ steps.set-op.outputs.software-version }}
# build for many platforms at the same time
platforms: |
linux/amd64
linux/arm64