Resource: adjust metadata fetching so it works with the arche-diss-cache #43
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: deploy on rancher | |
on: | |
workflow_dispatch: | |
inputs: | |
deploy: | |
type: boolean | |
description: Deploy if not a release | |
default: false | |
push: ~ | |
release: | |
types: [published] | |
env: | |
RANCHER_API_BASE: https://rancher.acdh-dev.oeaw.ac.at/v3 | |
RANCHER_PROJECT: Dissemination services | |
RANCHER_NAMESPACE: arche-biblatex | |
jobs: | |
testAndDeploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
extensions: json,yaml,pdo,pdo_sqlite | |
coverage: xdebug | |
- name: test | |
run: | | |
composer update | |
XDEBUG_MODE=coverage vendor/bin/phpunit --display-deprecations --display-phpunit-deprecations --display-notices --display-warnings | |
- name: prepare arche-prod and arche-cur configs | |
run: | | |
mkdir tmp && cd tmp | |
composer require -n zozlak/yaml-merge | |
curl https://arche.acdh.oeaw.ac.at/api/describe > prod.yaml | |
curl https://arche-curation.acdh-dev.oeaw.ac.at/api/describe > cur.yaml | |
vendor/bin/yaml-edit.php --src prod.yaml --src '{"dbConn": {"guest": "pgsql: host=10.6.16.94 port=5433 user=arche_thumbnails dbname=arche_prod"}}' ../archeProd.yaml | |
vendor/bin/yaml-edit.php --src cur.yaml --src '{"dbConn": {"guest": "pgsql: host=10.6.16.94 port=5433 user=arche_thumbnails dbname=arche_cur"}}' ../archeCur.yaml | |
cd .. && rm -fR tmp | |
- name: build docker image | |
run: | | |
git reset --hard HEAD | |
rm -fR vendor | |
mkdir build/docroot && cp -R `ls -1 | grep -v ^build` build/docroot/ && cp build/config/arche.yaml build/docroot/config.yaml | |
docker build --rm -t "acdhch/$RANCHER_NAMESPACE:latest" --build-arg VARIANT=production --label "buildUrl=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" build | |
- name: test image | |
run: | | |
docker run -d --name "$RANCHER_NAMESPACE" -v `pwd`/tests/config.yaml:/var/www/html/config.yaml -p 8080:80 "acdhch/$RANCHER_NAMESPACE:latest" | |
sleep 1 | |
curl -f -i 'http://127.0.0.1:8080/?id=https%3A%2F%2Fhdl.handle.net%2F21.11115%2F0000-000E-5942-4' | |
curl -f -i 'http://127.0.0.1:8080/?id=https%3A%2F%2Fhdl.handle.net%2F21.11115%2F0000-000E-5942-4' | |
- name: authorize against docker hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: push to docker hub | |
if: github.event_name == 'release' && github.event.action == 'published' || inputs.deploy | |
run: docker push "acdhch/$RANCHER_NAMESPACE:latest" | |
- name: redeploy on rancher | |
if: github.event_name == 'release' && github.event.action == 'published' || inputs.deploy | |
run: | | |
BASE_URL=`curl -s -H "Authorization: Bearer ${{ secrets.RANCHERTOKEN }}" "$RANCHER_API_BASE/projects" | jq -r ".data[] | select(.name == \"$RANCHER_PROJECT\") | .links.workloads"` | |
curl -i -X POST -H "Authorization: Bearer ${{ secrets.RANCHERTOKEN }}" "$BASE_URL/deployment:$RANCHER_NAMESPACE:$RANCHER_NAMESPACE?action=redeploy" | |
- name: coveralls | |
run: | | |
export COVERALLS_RUN_LOCALLY=1 | |
export COVERALLS_REPO_TOKEN=${{ secrets.coverallsToken }} | |
rm -fR composer.json composer.lock vendor | |
composer require php-coveralls/php-coveralls | |
php vendor/bin/php-coveralls -v | |