webman/.forgejo/workflows/build-container.yaml

33 lines
1.1 KiB
YAML

name: Build and push Docker image
on:
push:
jobs:
build-and-publish:
runs-on: docker
steps:
- uses: actions/checkout@v4
- name: Build latest
uses: https://codeberg.org/umglurf/kaniko-action@main
with:
cache: true
cache_repo: ${{ vars.REGISTRY_URL }}/${{ github.repository }}/cache
credentials: |
${{ vars.REGISTRY_URL }}=${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_TOKEN }}
destinations: |
${{ vars.REGISTRY_URL }}/${{ github.repository }}:latest
push: 'true'
if: github.ref == 'refs/heads/master'
- name: Build ref
uses: https://codeberg.org/umglurf/kaniko-action@main
with:
cache: true
cache_repo: ${{ vars.REGISTRY_URL }}/${{ github.repository }}/cache
credentials: |
${{ vars.REGISTRY_URL }}=${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_TOKEN }}
destinations: |
${{ vars.REGISTRY_URL }}/${{ github.repository }}:${{ github.ref_name }}
push: 'true'
if: github.ref != 'refs/heads/master'