fix: update branch name #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WARNING: If you modify this workflow, please update the documentation | |
on: | |
workflow_call: | |
inputs: | |
target: | |
description: | | |
The target used to mark publish builds. This target should be unique | |
across all Earthly files in the repository. The target should always | |
produce at least one image which is optionally published to the | |
configured registries. | |
required: false | |
type: string | |
default: publish | |
aws_ecr_registry: | |
description: | | |
The AWS ECR registry that will be used to publish images | |
required: false | |
type: string | |
aws_role_arn: | |
description: | | |
The ARN of the AWS role that will be assumed by the workflow. Only | |
required when configuring a remote Earthly runner or AWS ECR. | |
required: false | |
type: string | |
aws_region: | |
description: | | |
The AWS region that will be used by the workflow. Only required when | |
configuring a remote Earthly runner or AWS ECR. | |
required: false | |
type: string | |
ci_cli_version: | |
description: | | |
The version of the CI CLI to use. | |
required: false | |
type: string | |
default: latest | |
default_branch: | |
description: | | |
The default branch of the repository. | |
required: false | |
type: string | |
default: ${{ github.event.repository.default_branch }} | |
earthly_version: | |
description: The version of Earthly to use. | |
required: false | |
type: string | |
default: latest | |
skip_publish_on_default: | |
description: | | |
If set to true, images will not be published when the workflow is | |
triggered by a push to the default branch. | |
required: false | |
type: boolean | |
default: false | |
tags: | |
description: | | |
A line separated list of additional tags that will be applied to | |
published images. | |
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 | |
Earthly files. | |
required: false | |
earthly_runner_secret: | |
description: | | |
The ID of the AWS secret holding Earthly remote runner credentials. | |
This secret must contain the runner address and the necessary TLS | |
certificates required to authenticate with it. If omitted, a remote | |
Earthly runner will not be configured. | |
required: false | |
jobs: | |
discover: | |
runs-on: ubuntu-latest | |
outputs: | |
json: ${{ steps.check.outputs.json }} | |
paths: ${{ steps.check.outputs.paths }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup CI | |
uses: input-output-hk/catalyst-ci/actions/setup@@feat/udcmigration | |
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@@feat/udcmigration | |
id: discover | |
with: | |
targets: ${{ inputs.target }} | |
- name: Check for empty output | |
id: check | |
run: | | |
json=$(echo '${{ steps.discover.outputs.json }}' | jq -rc) | |
paths=$(echo '${{ steps.discover.outputs.paths }}' | jq -rc) | |
if [ "$output" == "null" ]; then | |
echo "json=[]" >> $GITHUB_OUTPUT | |
echo "paths=[]" >> $GITHUB_OUTPUT | |
else | |
echo "json=$json" >> $GITHUB_OUTPUT | |
echo "paths=$paths" >> $GITHUB_OUTPUT | |
fi | |
run: | |
runs-on: ubuntu-latest | |
needs: [discover] | |
if: needs.discover.outputs.paths != '[]' | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- linux/amd64 | |
earthfile: ${{ fromJson(needs.discover.outputs.paths) }} | |
steps: | |
- name: Get filtered targets | |
id: get_target | |
run: | | |
targets=$(echo '${{ needs.discover.outputs.json }}' | jq -r --arg key '${{ matrix.earthfile }}' '.[$key][]') | |
echo "Found targets: $targets" | |
targets_with_space=$(echo $targets | tr '\n' ' ') | |
echo "targets=$targets_with_space" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v3 | |
- name: Setup CI | |
uses: input-output-hk/catalyst-ci/actions/setup@@feat/udcmigration | |
with: | |
aws_ecr_registry: ${{ inputs.aws_ecr_registry }} | |
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 image | |
uses: input-output-hk/catalyst-ci/actions/run@@feat/udcmigration | |
id: build | |
with: | |
earthfile: ${{ matrix.earthfile }} | |
targets: ${{ steps.get_target.outputs.targets }} | |
platform: ${{ matrix.platform }} | |
runner_address: ${{ secrets.earthly_runner_address }} | |
- name: Push image | |
uses: input-output-hk/catalyst-ci/actions/push@@feat/udcmigration | |
if: github.ref == format('refs/heads/{0}', inputs.default_branch) && !inputs.skip_publish_on_default | |
with: | |
image: ${{ steps.build.outputs.image }} | |
registries: | | |
${{ inputs.aws_ecr_registry }} | |
tags: | | |
${{ github.sha }} | |
${{ inputs.tags }} | |
- name: Fetch tag | |
id: fetch_tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: Push release image | |
uses: input-output-hk/catalyst-ci/actions/push@@feat/udcmigration | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
image: ${{ steps.build.outputs.image }} | |
registries: | | |
${{ inputs.aws_ecr_registry }} | |
ghcr.io/${{ github.repository }} | |
tags: | | |
${{ steps.fetch_tag.outputs.tag }} |