-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (55 loc) · 1.9 KB
/
pygeoapi-image.yml
File metadata and controls
64 lines (55 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Publish Pygeoapi Docker Image
on:
push:
branches: [main]
paths:
- "pygeoapi/**"
- "data/**"
- ".github/workflows/pygeoapi-image.yml"
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Bump repo version
run: |
VERSION=$(cat VERSION)
IFS='.' read -r MAJ MIN PATCH <<<"$VERSION"
PATCH=$((PATCH+1))
NEW_VERSION="$MAJ.$MIN.$PATCH"
echo "$NEW_VERSION" > VERSION
echo "VERSION=$NEW_VERSION" >> "$GITHUB_ENV"
- name: Commit version bump
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add VERSION
git commit -m "chore: bump repo version to $VERSION" && git push || echo "No changes to commit"
- name: Get pygeoapi version
id: pgv
run: |
PYGEOAPI_VERSION=$(docker run --rm geopython/pygeoapi:latest pygeoapi --version | awk '{print $2}')
echo "PYGEOAPI_VERSION=$PYGEOAPI_VERSION" >> "$GITHUB_OUTPUT"
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.pygeoapi
push: true
build-args: |
REPO_VERSION=${{ env.VERSION }}
tags: |
ghcr.io/${{ github.repository_owner }}/pygeoapi-w-global-tsunami-data:latest
ghcr.io/${{ github.repository_owner }}/pygeoapi-w-global-tsunami-data:${{ steps.pgv.outputs.PYGEOAPI_VERSION }}-${{ env.VERSION }}