Some checks failed
Build and publish Docker image / build-and-push (push) Failing after 4m10s
67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
name: Build and publish Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
- master
|
|
tags:
|
|
- '*.*.*'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
IMAGE_NAME: rocky-dev
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
REGISTRY: ${{ runner.labels.filter(l => l.startsWith('registry=')).map(l => l.split('=')[1]).first() || 'gitea.sjs.io' }}
|
|
container:
|
|
image: gitea/runner-images:ubuntu-latest
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ vars.USERNAME }}
|
|
password: ${{ secrets.PASS }}
|
|
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ vars.USERNAME }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
# Only tag with version and latest on tag push
|
|
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
|
# Optionally, tag dev/master builds with branch name (for testing)
|
|
type=ref,event=branch,enable=${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|