|
32 | 32 | username: ${{ secrets.DOCKERHUB_USERNAME }} |
33 | 33 | password: ${{ secrets.DOCKERHUB_TOKEN }} |
34 | 34 |
|
| 35 | + - name: Check if stable release |
| 36 | + id: check-stable |
| 37 | + run: | |
| 38 | + TAG_NAME="${GITHUB_REF#refs/tags/}" |
| 39 | + if [[ "$TAG_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 40 | + echo "is_stable=true" >> $GITHUB_OUTPUT |
| 41 | + echo "This is a stable release: $TAG_NAME" |
| 42 | + else |
| 43 | + echo "is_stable=false" >> $GITHUB_OUTPUT |
| 44 | + echo "This is a pre-release: $TAG_NAME" |
| 45 | + fi |
| 46 | +
|
35 | 47 | - name: Extract metadata |
36 | 48 | id: meta |
37 | 49 | uses: docker/metadata-action@v5 |
|
43 | 55 | # For tags: extract full version without 'v' prefix (e.g., 0.5.2 or 0.5.2rc3) |
44 | 56 | type=match,pattern=v(.*),group=1,enable=${{ startsWith(github.ref, 'refs/tags/v') }} |
45 | 57 | # For stable releases only: extract major.minor (e.g., 0.5 from v0.5.2) |
46 | | - type=match,pattern=v(\d+\.\d+),group=1,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'rc') && !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') }} |
47 | | - # Tag as 'latest' only for non-prerelease version tags |
48 | | - type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'rc') && !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') }} |
| 58 | + type=match,pattern=v(\d+\.\d+),group=1,enable=${{ steps.check-stable.outputs.is_stable == 'true' }} |
| 59 | + # Tag as 'latest' only for stable releases |
| 60 | + type=raw,value=latest,enable=${{ steps.check-stable.outputs.is_stable == 'true' }} |
49 | 61 |
|
50 | 62 | - name: Set build timestamp |
51 | 63 | id: timestamp |
|
0 commit comments