|
43 | 43 | username: ${{ github.actor }} |
44 | 44 | password: ${{ secrets.GITHUB_TOKEN }} |
45 | 45 |
|
| 46 | + # Check if any version tags exist |
| 47 | + - name: Check for existing version tags |
| 48 | + id: check-tags |
| 49 | + run: | |
| 50 | + if git tag --list 'v*.*' | grep -q .; then |
| 51 | + echo "has_version_tags=true" >> $GITHUB_OUTPUT |
| 52 | + else |
| 53 | + echo "has_version_tags=false" >> $GITHUB_OUTPUT |
| 54 | + fi |
| 55 | +
|
46 | 56 | # Extract metadata (tags, labels) for Docker |
47 | 57 | # https://github.com/docker/metadata-action |
48 | 58 | - name: Extract Docker metadata |
|
52 | 62 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
53 | 63 | tags: | |
54 | 64 | type=raw,value=testing-${{ github.ref_name }} |
55 | | - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} |
| 65 | + type=raw,value=testing-main,enable=${{ github.ref == 'refs/heads/main' }} |
| 66 | + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && steps.check-tags.outputs.has_version_tags == 'false' }} |
| 67 | + type=semver,pattern={{version}} |
| 68 | + type=semver,pattern={{major}}.{{minor}} |
| 69 | + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} |
56 | 70 |
|
57 | 71 | # Build and push Docker image with Buildx (don't push on PR) |
58 | 72 | # https://github.com/docker/build-push-action |
|
0 commit comments