Skip to content

Commit

Permalink
add registry, registry-username, registry-password options
Browse files Browse the repository at this point in the history
  • Loading branch information
SlashNephy committed Oct 24, 2023
1 parent 83b771d commit 961ef88
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ on:
required: false
type: string
default: ''
registry:
required: false
type: string
default: 'ghcr.io'
registry-username:
required: false
type: string
default: ''
secrets:
registry-password:
required: false
build-args:
required: false

permissions:
contents: read
Expand All @@ -52,7 +65,7 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success' && !contains(github.ref, 'renovate'))
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout Repository
uses: actions/checkout@v3
Expand All @@ -65,9 +78,9 @@ jobs:
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: 'ghcr.io'
username: '${{ github.repository_owner }}'
password: '${{ secrets.GITHUB_TOKEN }}'
registry: '${{ inputs.registry }}'
username: ${{ (inputs.registry-username != '' && inputs.registry-username) || github.repository_owner }}
password: ${{ (secrets.registry-password != '' && secrets.registry-password) || secrets.GITHUB_TOKEN }}

- name: Prepare Image Metadata
id: metadata
Expand Down Expand Up @@ -97,6 +110,7 @@ jobs:
IMAGE_TAG=${{ steps.metadata.outputs.version }}
COMMIT_ID=${{ github.sha }}
${{ inputs.build-args }}
${{ secrets.build-args }}
target: '${{ inputs.target }}'

- name: Scan Image
Expand Down

0 comments on commit 961ef88

Please sign in to comment.