Skip to content

chore: add logging

chore: add logging #46

name: CentralAPI docker build on tag
on:
push:
tags: [v*]
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build image
env:
ECR_REPOSITORY: ${{ secrets.CENTRAL_API_REPO_NAME }}
run: docker build -f ./src/CentralApi/Dockerfile ./src --tag $ECR_REPOSITORY --label "runnumber=${GITHUB_RUN_ID}"
- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push image
env:
ECR_REPOSITORY: ${{ secrets.CENTRAL_API_REPO_NAME }}
IMAGE_TAG: ${{ steps.get_version.outputs.VERSION }}
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$ECR_REPOSITORY
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
docker tag $ECR_REPOSITORY $IMAGE_ID:$IMAGE_TAG
docker push $IMAGE_ID:$IMAGE_TAG
if [[ ${{ steps.get_version.outputs.VERSION }} != *rc* && ${{ steps.get_version.outputs.VERSION }} != *beta* ]]; then
docker tag $IMAGE_ID:$IMAGE_TAG $IMAGE_ID:latest
docker push $IMAGE_ID:latest
fi