9999 VERSION=sha-${GITHUB_SHA::8}
100100 if [[ $GITHUB_REF == refs/tags/* ]]; then
101101 VERSION=${GITHUB_REF/refs\/tags\//}
102+ # 9.8.0-x --> 9.8.0
103+ VERSION=$(echo $VERSION | sed "s/-.*//" )
102104 fi
103105 echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
104106 echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
@@ -109,6 +111,7 @@ jobs:
109111 ARCH=amd64
110112 fi
111113 echo "ARCH=$ARCH" >> $GITHUB_OUTPUT
114+
112115 - name : Build docs image
113116 uses : docker/build-push-action@v6
114117 if : matrix.container == 'proj-docs'
@@ -131,6 +134,21 @@ jobs:
131134 org.opencontainers.image.revision=${{ github.sha }}
132135 org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
133136 org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
137+
138+ - name : Prepare tags
139+ id : prep_tags
140+ run : |
141+ TAGS="docker.io/osgeo/${{ matrix.container }}:${{ steps.prep.outputs.VERSION }}-${{ steps.prep.outputs.ARCH }}
142+ ghcr.io/osgeo/${{ matrix.container }}:${{ steps.prep.outputs.VERSION }}-${{ steps.prep.outputs.ARCH }}"
143+ if [ "${GITHUB_REF}" = "refs/heads/master" ]; then
144+ TAGS="$TAGS
145+ docker.io/osgeo/${{ matrix.container }}:latest-${{ steps.prep.outputs.ARCH }}
146+ ghcr.io/osgeo/${{ matrix.container }}:latest"-${{ steps.prep.outputs.ARCH }}"
147+ fi
148+ echo "tags<<EOF" >> $GITHUB_OUTPUT
149+ echo "$TAGS" >> $GITHUB_OUTPUT
150+ echo "EOF" >> $GITHUB_OUTPUT
151+
134152 - name : Build image
135153 uses : docker/build-push-action@v6
136154 id : push
@@ -141,11 +159,7 @@ jobs:
141159 context : .
142160 file : ${{ matrix.dockerfile }}
143161 platforms : linux/${{ steps.prep.outputs.ARCH }}
144- 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 }}
162+ tags : ${{ steps.prep_tags.outputs.tags }}
149163 labels : |
150164 org.opencontainers.image.title=${{ github.event.repository.name }}
151165 org.opencontainers.image.description=${{ github.event.repository.description }}
@@ -189,16 +203,38 @@ jobs:
189203 username : ${{ secrets.DOCKER_USERNAME }}
190204 password : ${{ secrets.DOCKER_PASSWORD }}
191205
206+ - name : Prepare
207+ id : prep
208+ run : |
209+ VERSION=sha-${GITHUB_SHA::8}
210+ if [[ $GITHUB_REF == refs/tags/* ]]; then
211+ VERSION=${GITHUB_REF/refs\/tags\//}
212+ # 9.8.0-x --> 9.8.0
213+ VERSION=$(echo $VERSION | sed "s/-.*//" )
214+ fi
215+ echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
216+
192217 - name : Create and push multi-platform manifest
193218 if : env.PUSH_PACKAGES == 'true'
194219 run : |
195220 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
221+ -t ghcr.io/osgeo/proj:${{ steps.prep.outputs.VERSION }} \
222+ ghcr.io/osgeo/proj:${{ steps.prep.outputs.VERSION }} -amd64 \
223+ ghcr.io/osgeo/proj:${{ steps.prep.outputs.VERSION }} -arm64
199224
200225 docker buildx imagetools create \
201- -t osgeo/proj:latest \
202- osgeo/proj:latest-amd64 \
203- osgeo/proj:latest-arm64
204-
226+ -t osgeo/proj:${{ steps.prep.outputs.VERSION }} \
227+ osgeo/proj:${{ steps.prep.outputs.VERSION }}-amd64 \
228+ osgeo/proj:${{ steps.prep.outputs.VERSION }}-arm64
229+
230+ if [ "${GITHUB_REF}" = "refs/heads/master" ]; then
231+ docker buildx imagetools create \
232+ -t ghcr.io/osgeo/proj:latest \
233+ ghcr.io/osgeo/proj:latest-amd64 \
234+ ghcr.io/osgeo/proj:latest-arm64
235+
236+ docker buildx imagetools create \
237+ -t osgeo/proj:latest \
238+ osgeo/proj:latest-amd64 \
239+ osgeo/proj:latest-arm64
240+ fi
0 commit comments