Add workflows/docker.yaml

This commit is contained in:
Zakary Timson 2023-11-24 16:05:38 +00:00
parent e5ac558032
commit 2b2868059f

68
workflows/docker.yaml Normal file
View File

@ -0,0 +1,68 @@
name: Build & Publish Dockerfile
on:
workflow_call:
inputs:
dockerfile:
type: string
required: false
default: Dockerfile
registry:
type: string
required: false
description: Docker registry FQDN
default: ${{github.server_url}}
user:
type: string
required: false
description: Docker user
default: ${{github.repository_owner}}
pass:
type: string
required: false
description: User password
default: ${{secrets.DEPLOY_TOKEN}}
name:
type: string
required: false
default: ${{github.repository}}
tag:
type: string
required: false
default: ${{github.ref_name}}
jobs:
docker:
name: Build & Publish Dockerfile
runs-on: ubuntu-latest
container: docker
steps:
- name: Clone Repository
uses: ztimson/actions/clone@develop
- name: Build Docker Image
uses: ztimson/actions/docker/build@develop
with:
registry: ${{inputs.registry}}
name: ${{inputs.name}}
tag: ${{inputs.tag}}
dockerfile: ${{inputs.dockerfile}}
- name: Push Docker Image
uses: ztimson/actions/docker/push@develop
with:
registry: ${{inputs.registry}}
user: ${{inputs.user}}
pass: ${{inputs.pass}}
name: ${{inputs.name}}
tag: ${{inputs.tag}}
- name: Tag as Latest
uses: ztimson/actions/docker/push@develop
if: ${{inputs.tag}} != latest && ${{github.ref_name}} == (git symbolic-ref refs/remotes/origin/HEAD --short | cut -c 7)
with:
registry: ${{inputs.registry}}
user: ${{inputs.user}}
pass: ${{inputs.pass}}
name: ${{inputs.name}}
tag: latest