Skip to content

Commit

Permalink
feat(ci): auto generate image version (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChandonPierre committed Oct 3, 2024
1 parent 2a53881 commit bb79201
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
on:
workflow_dispatch:
inputs:
version:
description: Version to tag the container with
required: true
type: string
publish:
description: Publish the container to the registry
required: true
Expand Down Expand Up @@ -48,8 +44,14 @@
make build-webui-image
make build-image-dirty
- name: Set image tag
run: |
git remote add upstream https://github.com/traefik/traefik.git
git fetch --tags upstream
echo "VERSION=$(git describe --tags --match 'v2.*' --exclude '*-' --abbrev=0)" >> $GITHUB_ENV
- name: Push image
if: ${{inputs.publish}}
run: |
docker tag traefik/traefik ghcr.io/${{ github.repository }}:${{ inputs.version }}-${GITHUB_SHA::7}
docker push ghcr.io/${{ github.repository }}:${{ inputs.version }}-${GITHUB_SHA::7}
docker tag traefik/traefik ghcr.io/${{ github.repository }}:${VERSION}-${GITHUB_SHA::7}
docker push ghcr.io/${{ github.repository }}:${VERSION}-${GITHUB_SHA::7}

0 comments on commit bb79201

Please sign in to comment.