diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 8a47d48..bdb9449 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,18 +1,47 @@ +# https://docs.docker.com/build/ci/github-actions/manage-tags-labels/ name: Docker Image CI on: push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] + branches: + - "**" + tags: + - "v*.*.*" jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag sedr:$(date +%s) + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + sedr + ghcr.io/metno/sedr + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build the Docker image + uses: docker/build-push-action@v6 + with: + run: docker build . --file Dockerfile --tag sedr:$(date +%s) + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/sedr.py b/sedr.py index d2c9254..b7a467c 100644 --- a/sedr.py +++ b/sedr.py @@ -10,7 +10,7 @@ from shapely.wkt import loads as wkt_loads from urllib.parse import urlsplit -sedr_version = "0.7.0" +sedr_version = "v0.7.0" edr_version = "1.1" # Globals