Skip to content

Missing return newId when creating new drug (#13) #62

Missing return newId when creating new drug (#13)

Missing return newId when creating new drug (#13) #62

name: Test and deploy
on:
push:
branches:
- main
tags:
- v*
pull_request: {}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dev: ['--dev','']
env:
DEVFLAG: ${{ matrix.dev }}
steps:
- name: Print Docker Compose version
run: |
docker --version
docker-compose --version
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Run thunorbld.py init/testinit
run: |
if [[ $DEVFLAG == "--dev" ]]; then python thunorbld.py init; fi
if [[ $DEVFLAG == "" ]]; then python thunorbld.py testinit; fi
- name: Test suite
run: python thunorbld.py $DEVFLAG test
- name: Upload coverage
if: ${{ matrix.dev == '--dev' }}
run: codecov
- name: Export Docker image
if: ${{ matrix.dev == '' && github.event_name == 'push' }}
run: docker save alubbock/thunorweb:dev | gzip > thunorweb-image.tar.gz
- name: Store build image as artifact for deploy stage
if: ${{ matrix.dev == '' && github.event_name == 'push' }}
uses: actions/upload-artifact@v2
with:
name: thunor-web-container
path: thunorweb-image.tar.gz
retention-days: 1
deploy:
needs: build
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Set release or dev mode
id: release_mode
run: |
if [ "$GITHUB_REF" == "refs/heads/main" ]; then
echo "::set-output name=qs_branch::dev"
else
echo "::set-output name=qs_branch::main"
echo "::set-output name=version::${GITHUB_REF/refs\/tags\//}"
fi
- name: Download build image artifact
uses: actions/download-artifact@v2
with:
name: thunor-web-container
- name: Load build image into Docker
run: docker load < thunorweb-image.tar.gz
- name: Checkout Thunor Web
uses: actions/checkout@v2
- name: Checkout Quickstart Repo
uses: actions/checkout@v2
with:
repository: alubbock/thunor-web-quickstart
ref: ${{ steps.release_mode.outputs.qs_branch }}
token: ${{ secrets.API_TOKEN_GITHUB }}
path: thunor-web-quickstart
- name: Update and push quickstart repo
run: |
set -e
if [ "$GITHUB_REF" != "refs/heads/main" ]; then
GITHUB_TAG=${GITHUB_REF/refs\/tags\//}
echo "GitHub Tag: $GITHUB_TAG"
fi
echo "$DOCKERHUB_TOKEN" | docker login -u alubbock --password-stdin
cd thunor-web-quickstart
cp ../thunorctl.py .
cp ../docker-compose.services.yml .
cp ../docker-compose.certbot.yml .
rm -rf config-examples
cp -r ../config-examples .
if [ -z "$GITHUB_TAG" ]; then
sed -i 's/thunorweb:latest/thunorweb:dev/' docker-compose.services.yml
echo "$GITHUB_SHA" > .release
else
sed -i "s/thunorweb:latest/thunorweb:$GITHUB_TAG/" docker-compose.services.yml
echo "$GITHUB_TAG" > .release
fi
echo "Contents of .release: $(cat .release)"
git add -A
git status
git config user.email "[email protected]"
git config user.name "GitHub Actions CI"
if [[ $GITHUB_TAG ]]; then
git commit -m "CI update: $GITHUB_TAG"
git tag "$GITHUB_TAG"
git push --tags
# Make another commit referencing "latest" at HEAD
sed -i "s/thunorweb:$GITHUB_TAG/thunorweb:latest/" docker-compose.services.yml
git add docker-compose.services.yml
fi
git commit -m "CI update: $GITHUB_SHA"
git push
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Tag and push dev image build
if: ${{ steps.release_mode.outputs.qs_branch == 'dev' }}
run: |
docker push alubbock/thunorweb:dev
- name: Tag and push live image build
if: ${{ steps.release_mode.outputs.qs_branch != 'dev' }}
run: |
docker tag alubbock/thunorweb:dev alubbock/thunorweb:latest
docker tag alubbock/thunorweb:dev alubbock/thunorweb:$GITHUB_TAG
docker push alubbock/thunorweb:$GITHUB_TAG
docker push alubbock/thunorweb:latest
env:
GITHUB_TAG: ${{ steps.release_mode.outputs.version }}
cleanup:
needs: deploy
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Delete build image artifact
uses: geekyeggo/delete-artifact@v1
with:
name: thunor-web-container