Skip to content

Commit

Permalink
feat: adds dockerhub support (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman authored Oct 30, 2023
1 parent bec1c48 commit 5e7704e
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 3 deletions.
1 change: 1 addition & 0 deletions .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cowsay
cytopia
devenv
dind
dockerhub
Earthfile
Earthfiles
errchkjson
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ on:
required: false
type: string
secrets:
dockerhub_username:
description: The token to use for logging into the DockerHub registry.
required: false
dockerhub_token:
description: The token to use for logging into the DockerHub registry.
required: false
earthly_runner_address:
description: |
The address of the Earthly runner that will be used to build the
Expand All @@ -66,6 +72,8 @@ jobs:
earthly_version: ${{ inputs.earthly_version }}
target: check
secrets:
dockerhub_token: ${{ secrets.dockerhub_token }}
dockerhub_username: ${{ secrets.dockerhub_username }}
earthly_runner_address: ${{ secrets.earthly_runner_address }}
earthly_runner_secret: ${{ secrets.earthly_runner_secret }}
build:
Expand All @@ -78,6 +86,8 @@ jobs:
earthly_version: ${{ inputs.earthly_version }}
target: check
secrets:
dockerhub_token: ${{ secrets.dockerhub_token }}
dockerhub_username: ${{ secrets.dockerhub_username }}
earthly_runner_address: ${{ secrets.earthly_runner_address }}
earthly_runner_secret: ${{ secrets.earthly_runner_secret }}
package:
Expand All @@ -90,6 +100,8 @@ jobs:
earthly_version: ${{ inputs.earthly_version }}
target: check
secrets:
dockerhub_token: ${{ secrets.dockerhub_token }}
dockerhub_username: ${{ secrets.dockerhub_username }}
earthly_runner_address: ${{ secrets.earthly_runner_address }}
earthly_runner_secret: ${{ secrets.earthly_runner_secret }}
test:
Expand All @@ -102,6 +114,8 @@ jobs:
earthly_version: ${{ inputs.earthly_version }}
target: check
secrets:
dockerhub_token: ${{ secrets.dockerhub_token }}
dockerhub_username: ${{ secrets.dockerhub_username }}
earthly_runner_address: ${{ secrets.earthly_runner_address }}
earthly_runner_secret: ${{ secrets.earthly_runner_secret }}
release:
Expand All @@ -114,6 +128,8 @@ jobs:
earthly_version: ${{ inputs.earthly_version }}
force_artifact: ${{ inputs.force_artifact }}
secrets:
dockerhub_token: ${{ secrets.dockerhub_token }}
dockerhub_username: ${{ secrets.dockerhub_username }}
earthly_runner_address: ${{ secrets.earthly_runner_address }}
earthly_runner_secret: ${{ secrets.earthly_runner_secret }}
publish:
Expand All @@ -127,5 +143,7 @@ jobs:
earthly_version: ${{ inputs.earthly_version }}
tags: ${{ inputs.tags }}
secrets:
dockerhub_token: ${{ secrets.dockerhub_token }}
dockerhub_username: ${{ secrets.dockerhub_username }}
earthly_runner_address: ${{ secrets.earthly_runner_address }}
earthly_runner_secret: ${{ secrets.earthly_runner_secret }}
2 changes: 2 additions & 0 deletions .github/workflows/dogfood.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ jobs:
aws_region: eu-central-1
ci_cli_version: 1.3.1
secrets:
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
earthly_runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }}
10 changes: 9 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ on:
required: false
type: string
secrets:
dockerhub_username:
description: The token to use for logging into the DockerHub registry.
required: false
dockerhub_token:
description: The token to use for logging into the DockerHub registry.
required: false
earthly_runner_address:
description: |
The address of the Earthly runner that will be used to build the
Expand All @@ -71,6 +77,7 @@ jobs:
uses: input-output-hk/catalyst-ci/actions/setup@master
with:
cli_version: ${{ inputs.ci_cli_version }}
configure_registries: "false"
earthly_skip_install: "true"
- name: Discover Earthly files
uses: input-output-hk/catalyst-ci/actions/discover@master
Expand Down Expand Up @@ -106,7 +113,8 @@ jobs:
aws_role_arn: ${{ inputs.aws_role_arn }}
aws_region: ${{ inputs.aws_region }}
cli_version: ${{ inputs.ci_cli_version }}
configure_registries: "true"
dockerhub_token: ${{ secrets.dockerhub_token }}
dockerhub_username: ${{ secrets.dockerhub_username }}
earthly_version: ${{ inputs.earthly_version }}
earthly_runner_secret: ${{ secrets.earthly_runner_secret }}
- name: Build image
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ on:
type: boolean
default: false
secrets:
dockerhub_username:
description: The token to use for logging into the DockerHub registry.
required: false
dockerhub_token:
description: The token to use for logging into the DockerHub registry.
required: false
earthly_runner_address:
description: |
The address of the Earthly runner that will be used to build the
Expand All @@ -68,6 +74,7 @@ jobs:
uses: input-output-hk/catalyst-ci/actions/setup@master
with:
cli_version: ${{ inputs.ci_cli_version }}
configure_registries: "false"
earthly_skip_install: "true"
- name: Discover Earthly files
uses: input-output-hk/catalyst-ci/actions/discover@master
Expand Down Expand Up @@ -102,6 +109,8 @@ jobs:
aws_role_arn: ${{ inputs.aws_role_arn }}
aws_region: ${{ inputs.aws_region }}
cli_version: ${{ inputs.ci_cli_version }}
dockerhub_token: ${{ secrets.dockerhub_token }}
dockerhub_username: ${{ secrets.dockerhub_username }}
earthly_version: ${{ inputs.earthly_version }}
earthly_runner_secret: ${{ secrets.earthly_runner_secret }}
- name: Build artifact
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ on:
type: string
default: latest
secrets:
dockerhub_username:
description: The token to use for logging into the DockerHub registry.
required: false
dockerhub_token:
description: The token to use for logging into the DockerHub registry.
required: false
earthly_runner_address:
description: |
The address of the Earthly runner that will be used to build the
Expand All @@ -56,6 +62,7 @@ jobs:
uses: input-output-hk/catalyst-ci/actions/setup@master
with:
cli_version: ${{ inputs.ci_cli_version }}
configure_registries: "false"
earthly_skip_install: "true"
- name: Discover Earthly files
uses: input-output-hk/catalyst-ci/actions/discover@master
Expand Down Expand Up @@ -88,6 +95,8 @@ jobs:
aws_role_arn: ${{ inputs.aws_role_arn }}
aws_region: ${{ inputs.aws_region }}
cli_version: ${{ inputs.ci_cli_version }}
dockerhub_token: ${{ secrets.dockerhub_token }}
dockerhub_username: ${{ secrets.dockerhub_username }}
earthly_version: ${{ inputs.earthly_version }}
earthly_runner_secret: ${{ secrets.earthly_runner_secret }}
- name: Run
Expand Down
18 changes: 16 additions & 2 deletions actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ inputs:
configure_registries:
description: If "true", the action will login to container registries
required: false
default: "false"
default: "true"
dockerhub_token:
description: The token to use for logging into the DockerHub registry
required: false
default: ""
dockerhub_username:
description: The username to use for logging into the DockerHub registry
required: false
default: ""
earthly_runner_secret:
description: |
The ID of the AWS secret holding Earthly remote runner credentials. This
Expand Down Expand Up @@ -68,9 +76,15 @@ runs:
with:
role-to-assume: ${{ inputs.aws_role_arn }}
aws-region: ${{ inputs.aws_region }}
- name: Login to Docker Hub
uses: docker/login-action@v3
if: ${{ inputs.dockerhub_username != '' && inputs.dockerhub_token != '' && inputs.configure_registries == 'true' }}
with:
username: ${{ inputs.dockerhub_username }}
password: ${{ inputs.dockerhub_token }}
- name: Login to ECR
uses: docker/login-action@v3
if: ${{ inputs.aws_role_arn != '' && inputs.aws_role_arn != '' && inputs.aws_ecr_registry != '' && inputs.configure_registries == 'true' }}
if: ${{ inputs.aws_role_arn != '' && inputs.aws_ecr_registry != '' && inputs.configure_registries == 'true' }}
with:
registry: ${{ inputs.aws_ecr_registry }}
- name: Login to GitHub Container Registry
Expand Down

0 comments on commit 5e7704e

Please sign in to comment.