Skip to content

URBIBBNA-44

URBIBBNA-44 #31

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: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: build publish-flotte-gbfs Docker image
uses: docker/build-push-action@v4
with:
context: publish-barshare-gbfs
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- 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 \
ghcr.io/bbnavi/publish-flotte-gbfs:main \
/bin/sh publish.sh bbnavi/flotte
deploy:
runs-on: [self-hosted, deploy]
needs:
- build-test-deploy
env:
MOQO_ACCESS_TOKEN: "${{ secrets.MOQO_ACCESS_TOKEN }}"
MINIO_ACCESS_KEY: "${{ secrets.OPENDATA_KEY }}"
MINIO_SECRET_KEY: "${{ secrets.OPENDATA_SECRET }}"
steps:
- uses: actions/checkout@v2
- name: Deploy Stack
run: |
docker stack deploy --compose-file ./publish-flotte-gbfs/docker-compose.yml commonsbooking2gbfs