Update docker/build/action.yaml
This commit is contained in:
parent
79d7b9986b
commit
540c913825
@ -1,40 +1,40 @@
|
||||
name: Docker Build
|
||||
description: Build docker image
|
||||
|
||||
inputs:
|
||||
dockerfile:
|
||||
type: string
|
||||
required: false
|
||||
default: Dockerfile
|
||||
registry:
|
||||
type: string
|
||||
required: false
|
||||
default: ${{github.server_url}}
|
||||
name:
|
||||
type: string
|
||||
required: false
|
||||
default: ${{github.repository}}
|
||||
tag:
|
||||
type: string
|
||||
required: false
|
||||
default: ${{github.ref_name}}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Creat Image Tag
|
||||
run: echo "URL=$(echo ${{github.server_url}} | sed s%http://%% | sed s%https://%% )" >> $GITHUB_ENV
|
||||
shell: sh
|
||||
|
||||
- name: Docker Build
|
||||
uses: docker://docker
|
||||
with:
|
||||
entrypoint: docker
|
||||
args: build -t "${{env.URL}}/${{inputs.name}}:${{inputs.tag}}" -f ${{inputs.dockerfile}} .
|
||||
|
||||
- name: Tag as Latest
|
||||
if: ${{inputs.tag}} != latest && ${{github.ref_name}} == (git symbolic-ref refs/remotes/origin/HEAD --short | cut -c 7)
|
||||
uses: docker://docker
|
||||
with:
|
||||
entrypoint: docker
|
||||
args: tag "${{env.URL}}/${{inputs.name}}:${{inputs.tag}}" "${{env.URL}}/${{inputs.name}}:latest"
|
||||
name: Docker Build
|
||||
description: Build docker image
|
||||
|
||||
inputs:
|
||||
dockerfile:
|
||||
type: string
|
||||
required: false
|
||||
default: Dockerfile
|
||||
registry:
|
||||
type: string
|
||||
required: false
|
||||
default: ${{github.server_url}}
|
||||
name:
|
||||
type: string
|
||||
required: false
|
||||
default: ${{github.repository}}
|
||||
tag:
|
||||
type: string
|
||||
required: false
|
||||
default: ${{github.ref_name}}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Creat Image Tag
|
||||
run: echo "URL=$(echo ${{github.server_url}} | sed s%http://%% | sed s%https://%% )" >> $GITHUB_ENV
|
||||
shell: sh
|
||||
|
||||
- name: Docker Build
|
||||
uses: docker://docker
|
||||
with:
|
||||
entrypoint: docker
|
||||
args: build --pull -t "${{env.URL}}/${{inputs.name}}:${{inputs.tag}}" -f ${{inputs.dockerfile}} .
|
||||
|
||||
- name: Tag as Latest
|
||||
if: ${{inputs.tag}} != latest && ${{github.ref_name}} == (git symbolic-ref refs/remotes/origin/HEAD --short | cut -c 7)
|
||||
uses: docker://docker
|
||||
with:
|
||||
entrypoint: docker
|
||||
args: tag "${{env.URL}}/${{inputs.name}}:${{inputs.tag}}" "${{env.URL}}/${{inputs.name}}:latest"
|
||||
|
Loading…
Reference in New Issue
Block a user