Skip to content

Commit

Permalink
Dev or specify image tag (#39)
Browse files Browse the repository at this point in the history
* default tag to dev for pr merge trigger, but allow user to specify tag on manual run

---------

Signed-off-by: 2byrds <2byrds@gmail.com>
  • Loading branch information
2byrds authored Aug 23, 2024
1 parent 749df82 commit b5e1036
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/publish-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ on:
branches:
- "main"
pull_request:
branches:
- "main"
types: [closed]
workflow_dispatch:
inputs:
version:
Expand All @@ -33,12 +32,23 @@ jobs:
with:
images: gleif/reg-pilot-api

- name: Determine Docker tag
id: docker_tag
run: |
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged }}" == "true" ]]; then
echo "::set-output name=tag::dev"
elif [[ -n "${{ github.event.inputs.version }}" ]]; then
echo "::set-output name=tag::${{ github.event.inputs.version }}"
else
echo "::set-output name=tag::dev"
fi
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: images/reg-pilot-api.dockerfile
push: true
tags: |
gleif/reg-pilot-api:${{ github.event.inputs.version }}
labels: ${{ github.event.inputs.version }}
context: .
file: images/reg-pilot-api.dockerfile
push: true
tags: |
gleif/reg-pilot-api:${{ steps.docker_tag.outputs.tag }}
labels: ${{ steps.docker_tag.outputs.tag }}

0 comments on commit b5e1036

Please sign in to comment.