Skip to content

Commit

Permalink
Use inputs again and added conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Nov 12, 2021
1 parent 9a5d502 commit 2fe3296
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/docker-webapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
release:
types: [published]
workflow_dispatch:
inputs:
branch:
description: 'Branch or commit to build'
required: true
default: 'develop'

env:
REGISTRY: ghcr.io
Expand All @@ -23,10 +28,16 @@ jobs:
packages: write
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
steps:
- uses: haya14busa/action-cond@v1
id: condval
with:
cond: ${{ github.event_name == 'workflow_dispatch' }}
if_true: "${{ github.event.inputs.branch }}"
if_false: " ${{ github.ref_name }}"
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.workflow_run.head_branch }}
ref: ${{ steps.condval.outputs.value }}

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/docker-webapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
release:
types: [published]
workflow_dispatch:
inputs:
branch:
description: 'Branch or commit to build'
required: true
default: 'develop'

env:
REGISTRY: ghcr.io
Expand All @@ -23,11 +28,16 @@ jobs:
packages: write
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
steps:
- uses: haya14busa/action-cond@v1
id: condval
with:
cond: ${{ github.event_name == 'workflow_dispatch' }}
if_true: "${{ github.event.inputs.branch }}"
if_false: " ${{ github.ref_name }}"
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.workflow_run.head_branch }}

ref: ${{ steps.condval.outputs.value }}
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
Expand Down

0 comments on commit 2fe3296

Please sign in to comment.