Skip to content

Commit

Permalink
Docker release fixes (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
greggbjensen authored Aug 16, 2024
1 parent 13d08b8 commit f2cf389
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .github/actions/deploy-tags/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Gets a set of release tags for deployment of Docker images and helm charts, this included `latest` and multiple versions like `1.2.15`, `1.2`, and `1`.

## Inputs

### `repository`

The docker repository to generate tags for. Example: `greggbjensen/prdeploy`

## Outputs

### `tags`
Expand All @@ -14,6 +20,8 @@ The comma separated list of tags to use.
- name: Deploy tags
id: deploy_tags
uses: greggbjensen/prdeploy/.github/actions/deploy-tags@main
with:
image: ${{ inputs.service_name }}

- name: Docker build and push
uses: docker/build-push-action@v5
Expand Down
16 changes: 11 additions & 5 deletions .github/actions/deploy-tags/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Date version
description: Gets a set of release tags for deployment of Docker images and helm charts, this included `latest` and multiple versions like `1.2.15`, `1.2`, and `1`.
inputs:
repository:
required: true
description: The docker repository to generate tags for.
outputs:
tags:
value: ${{ steps.deploy_tags.outputs.tags }}
Expand All @@ -13,16 +17,18 @@ runs:
id: deploy_tags
shell: bash
env:
RELEASE_TAG: ${{ (github.event_name == 'release' && github.event.release.tag_name) && format('greggbjensen/{0}:latest, greggbjensen/{0}:{1}', inputs.service_name, github.event.release.tag_name) || format('greggbjensen/{0}:temp', inputs.service_name) }}
REPOSITORY: ${{ inputs.repository }}
RELEASE_TAG: ${{ (github.event_name == 'release' && github.event.release.tag_name) && github.event.release.tag_name || 'temp' }}
run: |
if [ "$RELEASE_TAG" == "temp" ]; then
echo "tags=temp" >> $GITHUB_OUTPUT
exit 0
fi
IFS='.' read -ra parts <<< "$RELEASE_TAG"
patch=$RELEASE_TAG
minor="${parts[0]}.${parts[1]}"
major="${parts[0]}"
tags="$patch, $minor, $major, latest"
patch="$REPOSITORY:$RELEASE_TAG"
minor="$REPOSITORY:${parts[0]}.${parts[1]}"
major="$REPOSITORY:${parts[0]}"
latest="$REPOSITORY:latest"
tags="$patch, $minor, $major, $latest"
echo "tags=$tags" >> $GITHUB_OUTPUT
8 changes: 8 additions & 0 deletions .github/workflows/_container-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ jobs:
tags: ${{ steps.deploy_tags.outputs.tags }}
file: ${{ inputs.service_name }}/Dockerfile
context: ${{ inputs.service_name }}

- name: Docker Hub description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: greggbjensen/${{ inputs.service_name }}
readme-filepath: ${{ inputs.service_name }}/README.md
2 changes: 1 addition & 1 deletion .github/workflows/charts-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ jobs:
charts=$(find ./helm-charts -maxdepth 1 -name "*.tgz")
for chart in $charts
do
helm push $chart oci://registry-1.docker.io/greggbjensen/charts
helm push $chart oci://registry-1.docker.io/greggbjensen
done

0 comments on commit f2cf389

Please sign in to comment.