Skip to content

Commit

Permalink
feat!: move registry-url to input
Browse files Browse the repository at this point in the history
registry-url is not secret. move to input

secret registry-url is deprecated. use input registry-url instead
  • Loading branch information
bateau84 committed Jun 5, 2023
1 parent 7974caa commit 5fb083a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
uses: ./.github/workflows/workflow.yaml
with:
runs-on: "['ubuntu-latest']"
registry-url: cr.example.com
name: test
context: ./test/image-ok
push: false
secrets:
registry-url: cr.example.com
registry-username: ""
registry-password: ""
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -26,12 +26,12 @@ jobs:
uses: ./.github/workflows/workflow.yaml
with:
runs-on: "['ubuntu-latest']"
registry-url: cr.example.com
name: test
context: ./test/image-vulnerable
push: false
trivy-error-is-success: true
secrets:
registry-url: cr.example.com
registry-username: ""
registry-password: ""
token: ${{ secrets.GITHUB_TOKEN }}
14 changes: 8 additions & 6 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ on:
type: boolean
default: false
description: Tag a successfully built image with the tag latest.
registry-url:
type: string
description: URL to the container registry.
required: true
runs-on:
type: string
default: "['self-hosted']"
Expand All @@ -46,9 +50,6 @@ on:
default: MEDIUM,HIGH,CRITICAL
description: Comma-separated list of severities to consider an error.
secrets:
registry-url:
description: URL to the container registry.
required: true
registry-username:
description: Username for the container registry.
required: true
Expand All @@ -59,6 +60,7 @@ on:
description: GitHub auth token.
required: true
outputs:
# TODO: add registry-url to image output
image-digest:
description: The image digest for this build.
value: ${{ jobs.build.outputs.image-digest }}
Expand Down Expand Up @@ -105,7 +107,7 @@ jobs:
name: Docker login
uses: docker/login-action@v2
with:
registry: ${{ secrets.registry-url }}
registry: ${{ inputs.registry-url }}
username: ${{ secrets.registry-username }}
password: ${{ secrets.registry-password }}
-
Expand Down Expand Up @@ -189,7 +191,7 @@ jobs:
id: meta
with:
images: |
${{ secrets.registry-url }}/${{ inputs.name }}
${{ inputs.registry-url }}/${{ inputs.name }}
tags: |
type=ref,event=pr
type=raw,value=${{ github.sha }}
Expand All @@ -199,7 +201,7 @@ jobs:
name: Docker login
uses: docker/login-action@v2
with:
registry: ${{ secrets.registry-url }}
registry: ${{ inputs.registry-url }}
username: ${{ secrets.registry-username }}
password: ${{ secrets.registry-password }}
-
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
uses: nrkno/github-workflow-docker-build-push/.github/workflows/workflow.yaml@v1
with:
runs-on: "['self-hosted', 'linux']"
registry-url: registry-url-string
name: my-project-name/my-image-name
# Tag with 'latest' tag when merging to main
tag-latest: ${{ github.ref == 'refs/heads/main' }}
# Only push when merging to main
push: ${{ github.ref == 'refs/heads/main' }}
secrets:
registry-url: secret-string
registry-username: secret-string
registry-password: secret-string
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 5fb083a

Please sign in to comment.