Skip to content

Commit

Permalink
feat: allows overwriting the default branch of a repository (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman authored Nov 30, 2023
1 parent b9f4695 commit c2f7d03
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ on:
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 }}
deployment_images:
description: A newline separated list of image names to deploy
required: false
Expand Down Expand Up @@ -160,6 +166,7 @@ jobs:
aws_role_arn: ${{ inputs.aws_role_arn }}
aws_region: ${{ inputs.aws_region }}
ci_cli_version: ${{ inputs.ci_cli_version }}
default_branch: ${{ inputs.default_branch }}
earthly_version: ${{ inputs.earthly_version }}
skip_publish_on_default: ${{ inputs.skip_publish_on_default }}
tags: ${{ inputs.tags }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ on:
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
Expand Down Expand Up @@ -134,7 +140,7 @@ jobs:
runner_address: ${{ secrets.earthly_runner_address }}
- name: Push image
uses: input-output-hk/catalyst-ci/actions/push@master
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && !inputs.skip_publish_on_default
if: github.ref == format('refs/heads/{0}', inputs.default_branch) && !inputs.skip_publish_on_default
with:
image: ${{ steps.build.outputs.image }}
registries: |
Expand Down
11 changes: 6 additions & 5 deletions docs/src/reference/workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ It then uses the custom `push` GitHub Action to re-tag the image and push it to

### Inputs

| Name | Type | Description | Required | Default |
| ---------------- | ------ | ---------------------------------------------------------------------------------- | -------- | --------- |
| target | string | The target used to mark check builds | No | `publish` |
| aws_ecr_registry | string | The AWS ECR registry that will be used to publish images | No | `""` |
| tags | string | A line separated list of additional tags that will be applied to published images. | No | `""` |
| Name | Type | Description | Required | Default |
| ---------------- | ------ | ---------------------------------------------------------------------------------- | -------- | ----------------------------------------------- |
| aws_ecr_registry | string | The AWS ECR registry that will be used to publish images | No | `""` |
| default_branch | string | The default branch of the repository. | No | `${{ github.event.repository.default_branch }}` |
| tags | string | A line separated list of additional tags that will be applied to published images. | No | `""` |
| target | string | The target used to mark check builds | No | `publish` |

## Release

Expand Down

0 comments on commit c2f7d03

Please sign in to comment.