Skip to content

Added aanvrager name and fallback options to zaakoverzicht and zaakalgemeen #113

Added aanvrager name and fallback options to zaakoverzicht and zaakalgemeen

Added aanvrager name and fallback options to zaakoverzicht and zaakalgemeen #113

Workflow file for this run

name: Docker CI
on:
pull_request:
branches:
- main
- acceptance
- development
push:
branches:
- main
- acceptance
- development
jobs:
build-node:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
# run: npm test
- name: Set release code
if: (success() || failure())
id: releasecode #version number in a more comprehensible format: 0.1.YearMonthDay in UTC
run: |
export VERSION=$(grep APP_VERSION= .env | cut -d '=' -f2)
export RELEASE=$VERSION.$(date --utc +%Y%m%d)
echo "RELEASE=$RELEASE" >> $GITHUB_ENV
echo "##[set-output name=releasename]$RELEASE"
- name: Set APP_BUILD to dev
if: contains( github.ref, 'development') || contains(github.base_ref, 'development')
run: |
echo "APP_ENV=dev">> $GITHUB_ENV
echo "APP_BUILD=dev">> $GITHUB_ENV
echo "set APP_ENV to $APP_ENV"
- name: Set APP_BUILD to acceptance
if: contains( github.ref, 'acceptance') || contains(github.base_ref, 'acceptance')
run: |
echo "APP_ENV=accp">> $GITHUB_ENV
echo "APP_BUILD=acceptance">> $GITHUB_ENV
echo "set APP_ENV to $APP_ENV"
- name: Set APP_BUILD to latest
if: contains( github.ref, 'main') || contains(github.base_ref, 'main')
run: |
echo "APP_ENV=prod">> $GITHUB_ENV
echo "APP_BUILD=latest">> $GITHUB_ENV
echo "set APP_ENV to $APP_ENV"
- name: Print Build
run: echo "This build creates a container with tag $APP_BUILD"
- name: Setting CONTAINER_PROJECT_NAME
run: |
export NAME=$(grep CONTAINER_PROJECT_NAME= .env | cut -d '=' -f2)
echo "CONTAINER_PROJECT_NAME=$NAME" >> $GITHUB_ENV
- name: Setting CONTAINER_REGISTRY_BASE
run: |
export NAME=$(grep CONTAINER_REGISTRY_BASE= .env | cut -d '=' -f2)
echo "CONTAINER_REGISTRY_BASE=$NAME" >> $GITHUB_ENV
- name: Build Docker image
run: docker-compose -f docker-compose.deploy.yaml build --build-arg APP_ENV=$APP_ENV --build-arg APP_BUILD=$APP_BUILD
- name: Run Docker image
run: docker-compose -f docker-compose.deploy.yaml up -d
- name: Pause for the container to come up
run: sleep 10
- name: Show docker logs
run: docker-compose -f docker-compose.deploy.yaml logs
- name: Add docker tags
if: github.ref == 'refs/heads/main'
run: |
images=$(docker-compose -f docker-compose.deploy.yaml images -q | xargs docker inspect --format='{{ index .RepoTags 0}}' | cut -d':' -f1 | grep $CONTAINER_PROJECT_NAME)
for image in $images
do
docker tag "${image}":latest "${image}":"${APP_BUILD}"
done
echo 'IMAGES=$images' >> $GITHUB_ENV
- name: Login to Container Registry
id: containerregistry-login
run: |
if [ "${{ secrets.GITHUB_TOKEN }}" != "" ]; then
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $(cut -d'/' -f1 <<< $GITHUB_REPOSITORY) --password-stdin
echo "##[set-output name=success;]true"
else
echo "##[set-output name=success;]false"
fi
- name: Push docker images
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/acceptance' || github.ref == 'refs/heads/development'
run: docker-compose -f docker-compose.deploy.yaml push
- if: steps.containerregistry-login.outputs.success == 'true' && github.ref == 'refs/heads/main'
name: Push versioned containers to Container Registry
id: version-push
run: |
images=$(docker-compose -f docker-compose.deploy.yaml images -q | xargs docker inspect --format='{{ index .RepoTags 0}}' | cut -d':' -f1 | grep $CONTAINER_PROJECT_NAME)
for image in $images
do
docker push "${image}":"${APP_BUILD}"
done
- name: Chores
run: docker-compose -f docker-compose.deploy.yaml down -v