Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/reusable-docker-ecr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ on:
required: false
default: us-west-2
type: string
release_branch:
file:
required: false
default: main
type: string
develop_branch:
required: false
default: develop
default: Dockerfile
type: string
secrets:
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true

concurrency:
group: ${{ inputs.version_tag }}
cancel-in-progress: true

jobs:
dockerize:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,7 +57,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
push: true
file: ./${{ inputs.file }}
push: ${{ ! github.event.pull_request.head.repo.fork }}
tags: |
${{ inputs.ecr_registry }}/${{ env.REPO }}:${{ inputs.version_tag }}
labels: |
Expand All @@ -66,14 +67,14 @@ jobs:
org.opencontainers.image.revision=${{ github.sha }}

- name: Add test tag
if: github.ref == format('refs/heads/{0}', inputs.develop_branch)
if: ${{ github.event_name != 'pull_request' && contains(inputs.version_tag, '.dev') }}
uses: akhilerm/tag-push-action@v2.2.0
with:
src: ${{ inputs.ecr_registry }}/${{ env.REPO }}:${{ inputs.version_tag }}
dst: ${{ inputs.ecr_registry }}/${{ env.REPO }}:test

- name: Add latest tag
if: github.ref == format('refs/heads/{0}', inputs.release_branch)
if: ${{ github.event_name != 'pull_request' && ! contains(inputs.version_tag, '.dev') }}
uses: akhilerm/tag-push-action@v2.2.0
with:
src: ${{ inputs.ecr_registry }}/${{ env.REPO }}:${{ inputs.version_tag }}
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/reusable-docker-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ on:
version_tag:
required: true
type: string
release_branch:
required: false
default: main
type: string
develop_branch:
required: false
default: develop
type: string
user:
required: false
default: tools-bot
Expand All @@ -24,6 +16,10 @@ on:
USER_TOKEN:
required: true

concurrency:
group: ${{ inputs.version_tag }}
cancel-in-progress: true

jobs:
dockerize:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -64,14 +60,14 @@ jobs:
org.opencontainers.image.revision=${{ github.sha }}

- name: Add test tag
if: ${{ github.ref == format('refs/heads/{0}', inputs.develop_branch) && ! github.event.pull_request.head.repo.fork }}
if: ${{ github.event_name != 'pull_request' && contains(inputs.version_tag, '.dev') }}
uses: akhilerm/tag-push-action@v2.2.0
with:
src: ghcr.io/${{ env.REPO }}:${{ inputs.version_tag }}
dst: ghcr.io/${{ env.REPO }}:test

- name: Add latest tag
if: ${{ github.ref == format('refs/heads/{0}', inputs.release_branch) && ! github.event.pull_request.head.repo.fork }}
if: ${{ github.event_name != 'pull_request' && ! contains(inputs.version_tag, '.dev') }}
uses: akhilerm/tag-push-action@v2.2.0
with:
src: ghcr.io/${{ env.REPO }}:${{ inputs.version_tag }}
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/reusable-git-object-name.yml

This file was deleted.

8 changes: 2 additions & 6 deletions .github/workflows/update-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ on:
- v*

jobs:
call-git-object-name-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-git-object-name.yml@v0.18.1

upate_actions_examples:
needs: call-git-object-name-workflow
update-actions-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -26,8 +22,8 @@ jobs:
- name: Get version number
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
OBJECT_VERSION: ${{ needs.call-git-object-name-workflow.outputs.name }}
run: |
OBJECT_VERSION=$(git describe --dirty --tags --long --match "*[0-9]*")
if [[ -z "${INPUT_VERSION}" ]]; then
echo "ACTIONS_VERSION=${OBJECT_VERSION%%-*}" >> $GITHUB_ENV
else
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,46 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.20.0]

### Added
- The `reusable-docker-ecr.yml` workflow now accepts a `file` input for specifying the name of the dockerfile to build.

### Changed
- The `update-examples.yml` workflow no longer used the `reusable-git-object-name.yml` workflow.
- The `reusable-docker-ecr.yml` and `reusable-docker-ghcr.yml` workflows have changed substantially! These workflows are now version-centric instead of branch-centric and their usage has changed. Please make these changes to any calling workflow:
```diff
on:
push:
branches:
- - main
- develop
+ tags:
+ - 'v*'
pull_request:
branches:
- main
- develop
```

and:
```diff
uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@v0.19.0
...
with:
- release_branch: main
- develop_branch: develop
...
```

For current usage, see the [README](README.md) and for more details about these changes, see https://github.com/ASFHyP3/actions/pull/288.

### Fixed
- `latest` tag will now be applied to release-tagged Docker images correctly. Fixes https://github.com/ASFHyP3/actions/issues/278

### Removed
- The `reusable-git-object-name.yml` workflow has been removed. We recommend using the `reusable-version-info.yml` workflow instead.

## [0.19.0]

### Added
Expand Down
63 changes: 18 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,22 @@ Therefore, to determine both the custom field name and the sprint ID, do the fol

Builds a Docker image from the `Dockerfile` in the repository root and pushes it to the
[Amazon Elastic Container Registry](https://aws.amazon.com/ecr/)
with the specified version tag, and is best paired with either the `reusable-version-info.yml` workflow or the `reusable-git-object-name.yml` workflow. This workflow will
additionally push the image with a `latest` and `test` tag for merges to the release and develop branch, respectively.
Use like:
with the specified version tag, and is best paired with the `reusable-version-info.yml` workflow. This workflow will
additionally push the image with a `latest` tag for releases and a `test` tag for pushes to the develop branch.

> [!WARNING]
> This action assumes version numbers follow [PEP-440](https://peps.python.org/pep-0440/) and applies the `latest` tag to
> all [non-developmental](https://peps.python.org/pep-0440/#developmental-releases) versions.

```yaml
name: Build

on:
push:
branches:
- main
- develop
tags:
- 'v*'
pull_request:
branches:
- main
Expand All @@ -172,8 +176,7 @@ jobs:
version_tag: ${{ needs.call-version-info-workflow.outputs.version_tag }}
ecr_registry: 845172464411.dkr.ecr.us-west-2.amazonaws.com
aws_region: us-west-2 # Optional; default shown
release_branch: main # Optional; default shown
develop_branch: develop # Optional; default shown
file: Dockerfile # Optional; default shown
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -183,8 +186,13 @@ jobs:

Builds a Docker image from the `Dockerfile` in the repository root and pushes it to the
[GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry)
with the specified version tag, and is best paired with the `reusable-version-info.yml` workflow or the `reusable-git-object-name.yml` workflow. This workflow will
additionally push the image with a `latest` and `test` tag for merges to the release and develop branch, respectively.
with the specified version tag, and is best paired with the `reusable-version-info.yml` workflow. This workflow will
additionally push the image with a `latest` tag for releases and a `test` tag for pushes to the develop branch.

> [!WARNING]
> This action assumes version numbers follow [PEP-440](https://peps.python.org/pep-0440/) and applies the `latest` tag to
> all [non-developmental](https://peps.python.org/pep-0440/#developmental-releases) versions.

Use like:

```yaml
Expand All @@ -193,8 +201,9 @@ name: Build
on:
push:
branches:
- main
- develop
tags:
- 'v*'
pull_request:
branches:
- main
Expand All @@ -217,8 +226,6 @@ jobs:
with:
version_tag: ${{ needs.call-version-info-workflow.outputs.version_tag }}
user: ${{ github.actor }}
release_branch: main # Optional; default shown
develop_branch: develop # Optional; default shown
file: Dockerfile # Optional; default shown
secrets:
USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -382,40 +389,6 @@ you should remove the [`check_untyped_defs`](https://mypy.readthedocs.io/en/stab
Removing this option can be helpful when adding mypy to an existing codebase with large portions of untyped code,
or if you simply want the ability to opt out of static type checking on a per-function basis.

### [`reusable-git-object-name.yml`](./.github/workflows/reusable-git-object-name.yml)

Outputs the human-readable git object name from [`git describe --dirty --tags --long --match "*[0-9]*"`](https://git-scm.com/docs/git-describe)
of the calling repository. Use like:

```yaml
name: Build

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
call-git-object-name-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-git-object-name.yml@v0.19.0
permissions:
contents: read

echo-git-object-name-outputs:
needs: call-git-object-name-workflow
runs-on: ubuntu-latest
permissions: {}
steps:
- run: |
echo "name: ${{ needs.call-git-object-name-workflow.outputs.name }}"
```
This workflow is intended to be paired with workflows like the `reusable-docker-ghcr.yml` workflow.

### [`reusable-labeled-pr-check.yml`](./.github/workflows/reusable-labeled-pr-check.yml)

Ensures a PR has been labeled with exactly 1 of these labels: `major`, `minor`, `patch` or `bumpless` to support the
Expand Down