|
8 | 8 |
|
9 | 9 | workflow_dispatch: |
10 | 10 |
|
| 11 | +concurrency: |
| 12 | + group: docker-publish |
| 13 | + cancel-in-progress: false |
| 14 | + |
11 | 15 | jobs: |
12 | 16 | build-and-push: |
13 | 17 | runs-on: ubuntu-latest |
|
41 | 45 | echo "tag=$TAG" >> "$GITHUB_OUTPUT" |
42 | 46 | echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" |
43 | 47 |
|
| 48 | + # Check if this version is the latest within the same major/major.minor |
| 49 | + VERSION="${TAG#v}" |
| 50 | + MAJOR=$(echo "$VERSION" | cut -d. -f1) |
| 51 | + MINOR=$(echo "$VERSION" | cut -d. -f1-2) |
| 52 | +
|
| 53 | + LATEST_IN_MAJOR=$(git tag --list "v${MAJOR}.*.*" --sort=-version:refname | head -1) |
| 54 | + if [ "$TAG" != "$LATEST_IN_MAJOR" ]; then |
| 55 | + echo "skip_major=true" >> "$GITHUB_OUTPUT" |
| 56 | + fi |
| 57 | +
|
| 58 | + LATEST_IN_MINOR=$(git tag --list "v${MINOR}.*" --sort=-version:refname | head -1) |
| 59 | + if [ "$TAG" != "$LATEST_IN_MINOR" ]; then |
| 60 | + echo "skip_minor=true" >> "$GITHUB_OUTPUT" |
| 61 | + fi |
| 62 | +
|
44 | 63 | - name: Set up QEMU |
45 | 64 | uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 |
46 | 65 |
|
|
54 | 73 | images: ghcr.io/${{ github.repository }} |
55 | 74 | tags: | |
56 | 75 | type=semver,pattern={{version}},value=${{ steps.version.outputs.tag }} |
57 | | - type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.tag }} |
58 | | - type=semver,pattern={{major}},value=${{ steps.version.outputs.tag }} |
| 76 | + ${{ steps.version.outputs.skip_minor != 'true' && format('type=semver,pattern={{{{major}}}}.{{{{minor}}}},value={0}', steps.version.outputs.tag) || '' }} |
| 77 | + ${{ steps.version.outputs.skip_major != 'true' && format('type=semver,pattern={{{{major}}}},value={0}', steps.version.outputs.tag) || '' }} |
59 | 78 | type=raw,value=sha-${{ steps.version.outputs.sha }},priority=100 |
60 | 79 |
|
61 | 80 | - name: Login to GHCR |
|
0 commit comments