Skip to content

Commit

Permalink
re-implement existing tagging system
Browse files Browse the repository at this point in the history
Signed-off-by: Achim Krämer <[email protected]>
  • Loading branch information
pxlfrk committed Feb 13, 2024
1 parent fff33cd commit 6cf63d6
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
- name: set Environment Variables
id: env
run: |
version_tag="${{github.ref_name}}"
echo "NOW=$(date +'%F %Z %T')" >> $GITHUB_ENV
- name: Docker meta
Expand All @@ -32,16 +31,10 @@ jobs:
# define global behaviour for tags
flavor: |
latest=false
# generate Docker tags based on the following events/attributes
# specify one tag which never gets set, to prevent the tag-attribute being empty, as it will fallback to a default
tags: |
# tag releases as latest, except prerelease tags like `v2.0.0-alpha.x`
type=raw,value=latest,enable=${{ !contains(github.ref, 'alpha') }}
# output v2.42.1-alpha.1 (incl. pre-releases)
type=semver,pattern=v{{version}}
# output v2.42.1 (excl. pre-releases)
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
# output v2
type=semver,pattern=v{{major}}
type=semver,pattern=v{{version}},enable=false
labels: |
org.opencontainers.image.title=${{github.event.repository.name}}
org.opencontainers.image.description="Backup Docker volumes locally or to any S3, WebDAV, Azure Blob Storage, Dropbox or SSH compatible storage"
Expand Down Expand Up @@ -73,13 +66,27 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


- name: Extract Docker tags
id: tags
run: |
version_tag="${{github.ref_name}}"
tags=($version_tag)
if [[ "$version_tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# prerelease tags like `v2.0.0-alpha.1` should not be released as `latest` nor `v2`
tags+=("latest")
tags+=($(echo "$version_tag" | cut -d. -f1))
fi
releases=""
for tag in "${tags[@]}"; do
releases="${releases:+$releases,}offen/docker-volume-backup:$tag,ghcr.io/offen/docker-volume-backup:$tag"
done
echo "releases=$releases" >> "$GITHUB_OUTPUT"
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
tags: ${{ steps.tags.outputs.releases }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 6cf63d6

Please sign in to comment.