Files
docker_build/action.yml

49 lines
1.2 KiB
YAML

name: docker setup and build
author: tom
descriptions: setup, login, builds and pushes a container as a package
inputs:
path:
description: 'the path where buildx should start'
required: false
default: '.'
name:
desciption: 'name of the package'
required: false
default: '${{ gitea.repository }}'
username:
description: 'username used to push the package'
required: true
password:
description: 'password used to push the package'
required: true
runs:
using: "composite"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: git.tmoron.fr
username: ${{ inputs.username }}
password: ${{ inputs.password }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:${{ input.path }}"
push: true
tags: git.tmoron.fr/${{ inputs.name }}:latest
- name: push to latest branch
run: |
if git ls-remote --exit-code --heads origin latest; then
git switch latest
git merge latest
else
git checkout -b latest
git push origin latest
fi