URBIBBNA-44 Goodie #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build & deploy publish-flotte-gbfs Docker image | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-test-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
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 | |
push: 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 \ | |
ghcr.io/bbnavi/publish-flotte-gbfs \ | |
/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 |