Skip to content

ci

ci #333

Workflow file for this run

name: ci
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '30 5 * * *'
jobs:
docker:
strategy:
matrix:
include:
- release_line: 'ltr'
- release_line: 'stable'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get version details
run: |
python ./scripts/get_latest_qgis_versions.py --release=${{ matrix.release_line }} --github_token=${{ secrets.GITHUB_TOKEN }} >> $GITHUB_ENV
- name: Check if image is already built
run: |
TOKEN=$(curl -u $GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }} https://ghcr.io/token\?scope\="qgis-slim:qgis-slim/qgis-slim:pull" | jq -r .token)
if curl --head --fail -H "Authorization: Bearer $TOKEN" https://ghcr.io/v2/opengisch/qgis-slim/manifests/${{ env.QGIS_VERSION_PATCH }}; then
echo "DO_BUILD=false" >> $GITHUB_ENV
else
echo "DO_BUILD=true" >> $GITHUB_ENV
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build base
uses: docker/build-push-action@v3
if: env.DO_BUILD == 'true'
with:
context: .
push: false
target: builder
build-args: |
QGIS_VERSION=${{ env.QGIS_VERSION_TAG }}
QGIS_VERSION_SHORT=${{ env.QGIS_VERSION_SHORT }}
cache-to: type=local,dest=cache
- name: Build release
uses: docker/build-push-action@v6
if: env.DO_BUILD == 'true'
with:
context: .
push: false
load: true
build-args: |
QGIS_VERSION=${{ env.QGIS_VERSION_TAG }}
QGIS_VERSION_SHORT=${{ env.QGIS_VERSION_SHORT }}
cache-from: type=local,src=cache
tags: |
ghcr.io/opengisch/qgis-slim:latest
ghcr.io/opengisch/qgis-slim:${{ matrix.release_line }}
ghcr.io/opengisch/qgis-slim:${{ env.QGIS_VERSION_SHORT }}
ghcr.io/opengisch/qgis-slim:${{ env.QGIS_VERSION_PATCH }}
- name: Test
run: |
docker run --rm ghcr.io/opengisch/qgis-slim:latest python3 -c 'from qgis.core import QgsApplication; QgsApplication([], False)'
- name: Push release
uses: docker/build-push-action@v6
if: env.DO_BUILD == 'true' && github.event_name != 'pull_request'
with:
context: .
push: true
build-args: |
QGIS_VERSION=${{ env.QGIS_VERSION_TAG }}
QGIS_VERSION_SHORT=${{ env.QGIS_VERSION_SHORT }}
cache-from: type=local,src=cache
tags: |
ghcr.io/opengisch/qgis-slim:latest
ghcr.io/opengisch/qgis-slim:${{ matrix.release_line }}
ghcr.io/opengisch/qgis-slim:${{ env.QGIS_VERSION_SHORT }}
ghcr.io/opengisch/qgis-slim:${{ env.QGIS_VERSION_PATCH }}
# - name: Build and push debug
# uses: docker/build-push-action@v3
# if: env.DO_BUILD == 'true'
# with:
# context: .
# push: true
# target: debug
# build-args: |
# QGIS_VERSION=${{ env.QGIS_VERSION_TAG }}
# QGIS_VERSION_SHORT=${{ env.QGIS_VERSION_SHORT }}
# cache-from: type=local,src=cache
# tags: |
# ghcr.io/opengisch/qgis-slim-debug:latest
# ghcr.io/opengisch/qgis-slim-debug:${{ matrix.release_line }}
# ghcr.io/opengisch/qgis-slim-debug:${{ env.QGIS_VERSION_SHORT }}
# ghcr.io/opengisch/qgis-slim-debug:${{ env.QGIS_VERSION_PATCH }}
#