Skip to content

Update projectsyn/commodore Docker tag to v1.25.0 #56

Update projectsyn/commodore Docker tag to v1.25.0

Update projectsyn/commodore Docker tag to v1.25.0 #56

---
name: Build & Push GitLab Container Image
"on":
push:
branches:
- main
tags:
- v*
pull_request: {}
jobs:
build:
runs-on: ubuntu-latest
env:
IMAGE: ${{ github.repository }}/gitlab
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set image version latest
if: github.ref == 'refs/heads/main'
run: echo "VERSION=latest" >> ${GITHUB_ENV}
- name: Set image version for PRs to branch name
if: github.event_name == 'pull_request'
run: echo "VERSION=${GITHUB_HEAD_REF//\//-}" >> ${GITHUB_ENV}
- name: Set image version from tag
if: startsWith(github.ref, 'refs/tags/v')
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> ${GITHUB_ENV}
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: '{{defaultContext}}:gitlab'
platforms: linux/amd64,linux/arm64
push: true
tags: 'ghcr.io/${{ env.IMAGE }}:${{ env.VERSION }}'
- name: Delete untagged container images
# We always delete all untagged container images after building an
# image. This way, there should never be stale untagged images laying
# around in the registry. In combination with the workflow that
# deletes PR tags after the PR is closed we should be able to keep the
# container image registry size in check.
uses: dataaxiom/ghcr-cleanup-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
package: ${{ github.event.repository.name }}/gitlab
validate: true