Skip to content

Merge pull request #767 from opengisch/cleanup-deprecated-code #451

Merge pull request #767 from opengisch/cleanup-deprecated-code

Merge pull request #767 from opengisch/cleanup-deprecated-code #451

name: Build and Push
on:
push:
branches:
- master
tags:
- "v*.*.*"
jobs:
build_and_push:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
id: prepare
run: |
VERSION="latest"
TAG=""
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
TAG=${VERSION}
echo ::set-output name=tag::${TAG}
git submodule update --init --recursive --depth 1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to dockerhub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# Application
- name: Docker Test Application
id: docker_test_application
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-app
file: ./docker-app/Dockerfile
- name: Docker Build and Push Application
id: docker_build_and_push_application
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
target: webserver_runtime
context: ./docker-app
file: ./docker-app/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: opengisch/qfieldcloud-app:${{ steps.prepare.outputs.tag }}
- name: Docker Build and Push Worker
id: docker_build_and_push_worker
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
target: worker_wrapper_runtime
context: ./docker-app
file: ./docker-app/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.tag }}
# Redis
- name: Docker Test Redis
id: docker_test_redis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-redis
file: ./docker-redis/Dockerfile
- name: Docker Build and Push Redis
id: docker_build_and_push_redis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-redis
file: ./docker-redis/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: opengisch/qfieldcloud-redis:${{ steps.prepare.outputs.tag }}
# QGIS
- name: Docker Test QGIS
id: docker_test_qgis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-qgis
file: ./docker-qgis/Dockerfile
- name: Docker Build and Push QGIS
id: docker_build_and_push_qgis
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-qgis
file: ./docker-qgis/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.tag }}
- name: Trigger deployment on private repository
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GIT_ACCESS_TOKEN }}
repository: opengisch/qfieldcloud-private
event-type: public_dispatch
client-payload: '{"version": "${{ steps.prepare.outputs.tag }}"}'