Skip to content

Commit b6175fc

Browse files
authored
Merge pull request #47 from wongcht/gdal_version_tag-use-gdal_version
GDAL_VERSION_TAG computed from GDAL_VERSION
2 parents b96182f + 9c00ce9 commit b6175fc

1 file changed

Lines changed: 36 additions & 21 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,26 @@ on:
1515
pull_request:
1616
workflow_dispatch:
1717

18-
env:
19-
GDAL_VERSION_TAG: 3.13
20-
2118
jobs:
19+
vars:
20+
runs-on: ubuntu-24.04
21+
outputs:
22+
gdal_version_tag: ${{ steps.gdal_version_tag.outputs.value }}
23+
steps:
24+
- uses: actions/checkout@v6
25+
26+
- name: Compute GDAL version tag
27+
id: gdal_version_tag
28+
run: |
29+
source versions.env
30+
if ! [[ "$GDAL_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
31+
echo "GDAL_VERSION must be in X.Y.Z format, got: $GDAL_VERSION" >&2
32+
exit 1
33+
fi
34+
echo "value=${GDAL_VERSION%.*}" >> "$GITHUB_OUTPUT"
35+
2236
build:
37+
needs: [vars]
2338
if: "!contains(github.event.head_commit.message, '[skip ci]')"
2439
strategy:
2540
matrix:
@@ -70,7 +85,7 @@ jobs:
7085
load: true
7186
file: dockerfiles/Dockerfile
7287
build-args: ${{ steps.versions.outputs.content }}
73-
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }}
88+
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }}-${{ matrix.arch }}
7489
cache-from: type=gha,scope=${{ matrix.arch }}
7590
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
7691

@@ -79,11 +94,11 @@ jobs:
7994
docker run \
8095
--entrypoint bash \
8196
-v ${{ github.workspace }}:/local \
82-
--rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }} \
97+
--rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }}-${{ matrix.arch }} \
8398
/local/tests/tests.sh
8499
85100
deploy-gdal:
86-
needs: [build]
101+
needs: [vars, build]
87102
if: contains(github.ref, 'tags') && github.event_name == 'push'
88103
strategy:
89104
matrix:
@@ -126,10 +141,10 @@ jobs:
126141
push: true
127142
cache-from: type=gha,scope=${{ matrix.arch }}
128143
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
129-
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }}
144+
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }}-${{ matrix.arch }}
130145

131146
deploy-gdal-manifest:
132-
needs: [deploy-gdal]
147+
needs: [vars, deploy-gdal]
133148
runs-on: ubuntu-24.04
134149
if: contains(github.ref, 'tags') && github.event_name == 'push'
135150
steps:
@@ -143,12 +158,12 @@ jobs:
143158
- name: Create multi-arch manifest
144159
run: |
145160
docker buildx imagetools create \
146-
-t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }} \
147-
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-amd64 \
148-
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-arm64
161+
-t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }} \
162+
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }}-amd64 \
163+
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }}-arm64
149164
150165
deploy-layers:
151-
needs: [deploy-gdal]
166+
needs: [vars, deploy-gdal]
152167
if: contains(github.ref, 'tags') && github.event_name == 'push'
153168
strategy:
154169
matrix:
@@ -182,12 +197,12 @@ jobs:
182197
--entrypoint bash \
183198
-e OUTPUT_ZIP=package-${{ matrix.arch }}.zip \
184199
-v ${{ github.workspace }}:/local \
185-
--rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }} \
200+
--rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }}-${{ matrix.arch }} \
186201
/local/scripts/create-layer.sh
187-
python scripts/deploy.py ${{ env.GDAL_VERSION_TAG }} --arch ${{ matrix.lambda_arch }} --package package-${{ matrix.arch }}.zip --deploy
202+
python scripts/deploy.py ${{ needs.vars.outputs.gdal_version_tag }} --arch ${{ matrix.lambda_arch }} --package package-${{ matrix.arch }}.zip --deploy
188203
189204
deploy-runtime:
190-
needs: [deploy-gdal]
205+
needs: [vars, deploy-gdal]
191206
if: contains(github.ref, 'tags') && github.event_name == 'push'
192207
strategy:
193208
matrix:
@@ -219,17 +234,17 @@ jobs:
219234
context: .
220235
file: dockerfiles/runtimes/python
221236
build-args: |
222-
GDAL_VERSION_TAG=${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }}
237+
GDAL_VERSION_TAG=${{ needs.vars.outputs.gdal_version_tag }}-${{ matrix.arch }}
223238
RUNTIME_VERSION=${{ matrix.runtime }}
224239
NUMPY_VERSION=2.4.2
225240
PKG_INSTALLER=dnf
226241
push: true
227242
cache-from: type=gha,scope=python${{ matrix.runtime }}-${{ matrix.arch }}
228243
cache-to: type=gha,mode=max,scope=python${{ matrix.runtime }}-${{ matrix.arch }}
229-
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }}-${{ matrix.arch }}
244+
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }}-python${{ matrix.runtime }}-${{ matrix.arch }}
230245

231246
deploy-runtime-manifest:
232-
needs: [deploy-runtime]
247+
needs: [vars, deploy-runtime]
233248
runs-on: ubuntu-24.04
234249
if: contains(github.ref, 'tags') && github.event_name == 'push'
235250
strategy:
@@ -246,9 +261,9 @@ jobs:
246261
- name: Create multi-arch manifest (python${{ matrix.runtime }})
247262
run: |
248263
docker buildx imagetools create \
249-
-t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }} \
250-
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }}-amd64 \
251-
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }}-arm64
264+
-t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }}-python${{ matrix.runtime }} \
265+
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }}-python${{ matrix.runtime }}-amd64 \
266+
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ needs.vars.outputs.gdal_version_tag }}-python${{ matrix.runtime }}-arm64
252267
253268
update-layer:
254269
needs: [deploy-layers]

0 commit comments

Comments
 (0)