Skip to content

URBIBBNA-44

URBIBBNA-44 #25

name: build & deploy publish-flotte-gbfs Docker image
on:
push:
branches:
- main
jobs:
build-test-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build commonsbooking2gbfs Docker image
uses: docker/build-push-action@v2
with:
context: .
tags: ghcr.io/bbnavi/commonsbooking2gbfs
- name: build publish-flotte-gbfs Docker image
uses: docker/build-push-action@v4
with:
context: publish-flotte-gbfs
load: true
tags: ghcr.io/bbnavi/publish-flotte-gbfs
- name: set up temporary local minIO instance
run: |
# create network to connect the containers
docker network create --attachable test
# start minIO
docker run --rm -d --name minio \
-p 9000:9000 --network test \
-e 'MINIO_ROOT_USER=some-user' -e 'MINIO_ROOT_PASSWORD=some-password' \
quay.io/minio/minio server /data
sleep 1
# create bucket
docker run --rm -i \
--network test -e 'MC_HOST_bbnavi=http://some-user:some-password@minio:9000' \
quay.io/minio/mc \
mb bbnavi/flotte
- name: test publish-flotte-gbfs with local minIO instance
run: |
# $MINIO_ACCESS_KEY & $MINIO_SECRET_KEY are not needed here, but publish.sh expects them.
# todo: make this a regular test shell script
docker run --rm -i \
--network test -e 'MC_HOST_bbnavi=http://some-user:some-password@minio:9000' \
-e GBFS_TMP_DIR=/tmp/gbfs \
-e MINIO_ACCESS_KEY=foo -e MINIO_SECRET_KEY=bar \
registry.gitlab.tpwd.de/tpwd/bb-navi/publish-flotte-gbfs \
/bin/sh publish.sh bbnavi/flotte
# https://twitter.com/derhuerst/status/1511660213111336961
# - name: inline env vars to work around quantum-cli support
# env:
# MINIO_ACCESS_KEY: "${{ secrets.MINIO_ACCESS_KEY }}"
# MINIO_SECRET_KEY: "${{ secrets.MINIO_SECRET_KEY }}"
# run: |
# cd publish-flotte-gbfs
# sudo apt install -y moreutils
# docker-compose -f quantum-stack.yml config | sponge quantum-stack.yml
# - name: publish publish-flotte-gbfs Docker image
# uses: docker/build-push-action@v4
# with:
# context: publish-flotte-gbfs
# push: true
# tags: registry.gitlab.tpwd.de/tpwd/bb-navi/publish-flotte-gbfs
# - name: deploy to bbnavi infrastructure
# env:
# QUANTUM_USER: "${{ secrets.QUANTUM_USER }}"
# QUANTUM_PASSWORD: "${{ secrets.QUANTUM_PASSWORD }}"
# QUANTUM_ENDPOINT: "tpwd-bb-navi"
# QUANTUM_STACK: "publish-flotte-gbfs-tpwd-bb-navi"
# run: |
# cd publish-flotte-gbfs
# docker run --rm -i \
# -v $PWD:/app -w /app \
# -e QUANTUM_USER -e QUANTUM_PASSWORD -e QUANTUM_ENDPOINT -e QUANTUM_STACK \
# r.planetary-quantum.com/quantum-public/cli:2 \
# quantum-cli stacks update --create --wait