55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
# Credits: https://www.vanmeeuwen.dev/blog/automating-docker-builds-with-gitea-actions
|
|
# https://gitea.com/gitea/runner-images/src/branch/main/.gitea/workflows/release.yaml
|
|
|
|
name: Build and push Docker image
|
|
run-name: Building image on ${{ gitea.actor }}'s commit
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
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: Login to registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: gitea.7o7.cx
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Set outputs
|
|
id: vars
|
|
env:
|
|
BRANCH_NAME: ${{ github.ref_name }}
|
|
run: |
|
|
echo branch_name="$BRANCH_NAME" | tee -a $GITHUB_OUTPUT
|
|
echo short_hash=$(git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: |
|
|
linux/amd64
|
|
linux/arm64
|
|
pull: true
|
|
push: true
|
|
tags: |
|
|
gitea.7o7.cx/kittyteam/kittybe:${{ steps.vars.outputs.branch_name }}-${{ steps.vars.outputs.short_hash }}
|
|
gitea.7o7.cx/kittyteam/kittybe:${{ steps.vars.outputs.branch_name }}-latest
|
|
|
|
- name: Log out from registry
|
|
if: always()
|
|
run: docker logout gitea.7o7.cx |