Update .github/workflows/docker-publish.yaml
All checks were successful
Build / Dependencies_NPM (push) Successful in 1m10s

This commit is contained in:
Zakary Timson 2023-07-28 13:23:26 +00:00
parent c8fd7339ca
commit 88be130719

View File

@ -1,42 +1,42 @@
name: Build & push docker image name: Build & push docker image
inputs: inputs:
registry: registry:
required: false required: false
type: string type: string
image: image:
required: true required: true
type: string type: string
tag: tag:
required: false required: false
type: string type: string
secrets: secrets:
registry_user: registry_user:
required: true required: true
type: string type: string
registry_pass: registry_pass:
required: true required: true
type: string type: string
jobs: jobs:
Build: Build:
runs-on: Docker runs-on: Docker
container: container:
image: docker image: docker
steps: steps:
- name: Login to registry - name: Login to registry
run:| run: |
REGISTRY=$([ "${{inputs.registry}}" -n ] && echo "${{inputs.registry}}" || echo "${{github.server.url}}") REGISTRY=$([ "${{inputs.registry}}" -n ] && echo "${{inputs.registry}}" || echo "${{github.server.url}}")
echo "${{secrets.registry_pass}}" | docker login -u "${{secrets.registry_user}}" --password-stdin "$REGISTRY" echo "${{secrets.registry_pass}}" | docker login -u "${{secrets.registry_user}}" --password-stdin "$REGISTRY"
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Create tag - name: Create tag
run: TAG=$([ "${{inputs.tag}}" -n ] && echo "${{inputs.tag}}" || [ "${{github.ref}}" == "refs/heads/develop" ] && echo "latest" || echo "${{github.ref.name}}" | sed -E "s/[_/]/-/g") run: TAG=$([ "${{inputs.tag}}" -n ] && echo "${{inputs.tag}}" || [ "${{github.ref}}" == "refs/heads/develop" ] && echo "latest" || echo "${{github.ref.name}}" | sed -E "s/[_/]/-/g")
- name: Build image - name: Build image
run: docker build --no-cache -t "${{inputs.image}}:$TAG" . run: docker build --no-cache -t "${{inputs.image}}:$TAG" .
- name: Push image - name: Push image
run: docker push "${{inputs.image}}:$TAG" run: docker push "${{inputs.image}}:$TAG"