88 pull_request :
99 paths-ignore :
1010 - ' docs/**'
11+ push :
12+ tags :
13+ - ' *.*.*'
1114 workflow_dispatch :
1215
1316
99102 VERSION=sha-${GITHUB_SHA::8}
100103 if [[ $GITHUB_REF == refs/tags/* ]]; then
101104 VERSION=${GITHUB_REF/refs\/tags\//}
105+ # 9.8.0-x --> 9.8.0
106+ VERSION=$(echo $VERSION | sed "s/-.*//" )
102107 fi
103108 echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
104109 echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
@@ -109,6 +114,7 @@ jobs:
109114 ARCH=amd64
110115 fi
111116 echo "ARCH=$ARCH" >> $GITHUB_OUTPUT
117+
112118 - name : Build docs image
113119 uses : docker/build-push-action@v6
114120 if : matrix.container == 'proj-docs'
@@ -131,6 +137,21 @@ jobs:
131137 org.opencontainers.image.revision=${{ github.sha }}
132138 org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
133139 org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
140+
141+ - name : Prepare tags
142+ id : prep_tags
143+ run : |
144+ TAGS="docker.io/osgeo/${{ matrix.container }}:${{ steps.prep.outputs.VERSION }}-${{ steps.prep.outputs.ARCH }}
145+ ghcr.io/osgeo/${{ matrix.container }}:${{ steps.prep.outputs.VERSION }}-${{ steps.prep.outputs.ARCH }}"
146+ if [ "${GITHUB_REF}" = "refs/heads/master" ]; then
147+ TAGS="$TAGS
148+ docker.io/osgeo/${{ matrix.container }}:latest-${{ steps.prep.outputs.ARCH }}
149+ ghcr.io/osgeo/${{ matrix.container }}:latest"-${{ steps.prep.outputs.ARCH }}"
150+ fi
151+ echo "tags<<EOF" >> $GITHUB_OUTPUT
152+ echo "$TAGS" >> $GITHUB_OUTPUT
153+ echo "EOF" >> $GITHUB_OUTPUT
154+
134155 - name : Build image
135156 uses : docker/build-push-action@v6
136157 id : push
@@ -142,10 +163,7 @@ jobs:
142163 file : ${{ matrix.dockerfile }}
143164 platforms : linux/${{ steps.prep.outputs.ARCH }}
144165 tags : |
145- docker.io/osgeo/${{ matrix.container }}:${{ steps.prep.outputs.VERSION }}-${{ steps.prep.outputs.ARCH }}
146- docker.io/osgeo/${{ matrix.container }}:latest-${{ steps.prep.outputs.ARCH }}
147- ghcr.io/osgeo/${{ matrix.container }}:${{ steps.prep.outputs.VERSION }}-${{ steps.prep.outputs.ARCH }}
148- ghcr.io/osgeo/${{ matrix.container }}:latest-${{ steps.prep.outputs.ARCH }}
166+ tags: ${{ steps.prep_tags.outputs.tags }}
149167 labels : |
150168 org.opencontainers.image.title=${{ github.event.repository.name }}
151169 org.opencontainers.image.description=${{ github.event.repository.description }}
@@ -189,16 +207,38 @@ jobs:
189207 username : ${{ secrets.DOCKER_USERNAME }}
190208 password : ${{ secrets.DOCKER_PASSWORD }}
191209
210+ - name : Prepare
211+ id : prep
212+ run : |
213+ VERSION=sha-${GITHUB_SHA::8}
214+ if [[ $GITHUB_REF == refs/tags/* ]]; then
215+ VERSION=${GITHUB_REF/refs\/tags\//}
216+ # 9.8.0-x --> 9.8.0
217+ VERSION=$(echo $VERSION | sed "s/-.*//" )
218+ fi
219+ echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
220+
192221 - name : Create and push multi-platform manifest
193222 if : env.PUSH_PACKAGES == 'true'
194223 run : |
195224 docker buildx imagetools create \
196- -t ghcr.io/osgeo/proj:latest \
197- ghcr.io/osgeo/proj:latest -amd64 \
198- ghcr.io/osgeo/proj:latest -arm64
225+ -t ghcr.io/osgeo/proj:${{ steps.prep.outputs.VERSION }} \
226+ ghcr.io/osgeo/proj:${{ steps.prep.outputs.VERSION }} -amd64 \
227+ ghcr.io/osgeo/proj:${{ steps.prep.outputs.VERSION }} -arm64
199228
200229 docker buildx imagetools create \
201- -t osgeo/proj:latest \
202- osgeo/proj:latest-amd64 \
203- osgeo/proj:latest-arm64
204-
230+ -t osgeo/proj:${{ steps.prep.outputs.VERSION }} \
231+ osgeo/proj:${{ steps.prep.outputs.VERSION }}-amd64 \
232+ osgeo/proj:${{ steps.prep.outputs.VERSION }}-arm64
233+
234+ if [ "${GITHUB_REF}" = "refs/heads/master" ]; then
235+ docker buildx imagetools create \
236+ -t ghcr.io/osgeo/proj:latest \
237+ ghcr.io/osgeo/proj:latest-amd64 \
238+ ghcr.io/osgeo/proj:latest-arm64
239+
240+ docker buildx imagetools create \
241+ -t osgeo/proj:latest \
242+ osgeo/proj:latest-amd64 \
243+ osgeo/proj:latest-arm64
244+ fi
0 commit comments