Skip to content

Commit

Permalink
actions
Browse files Browse the repository at this point in the history
Added workflow for automatically building and pushing image on main branch push or tag push
  • Loading branch information
Salvoxia committed Jun 25, 2023
1 parent 57f273a commit b853569
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .gitea/workflows/build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: build-image

on:
push:
branches:
- main
tags:
- '[0-9]+.*'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Convert repository name ot image name
id: image_name
run: |
sed -E -e 's/docker-//' -e 's/^/image_name=/' <<<"${{ gitea.repository }}" >> "$GITHUB_OUTPUT"
- name: Generate Docker tag names
id: meta
uses: https://gitea.com/zcube/metadata-action@gitea
with:
# list of Docker images to use as base name for tags
images: |
gitea.local.salvoxia.de/${{ steps.image_name.outputs.image_name }}
# generate Docker tags based on the following events/attributes
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
# Tags for non SemVer tag names
type=match,pattern=([0-9]+.*),group=1
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to local registry
uses: docker/login-action@v2
with:
registry: gitea.local.salvoxia.de
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
# Workaround until a new version of build-push-action is released
env:
ACTIONS_RUNTIME_TOKEN: ''
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm
push: true
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit b853569

Please sign in to comment.