Skip to content

Implement the peer review process completion indicator to Kotahi DocMaps API #834

Implement the peer review process completion indicator to Kotahi DocMaps API

Implement the peer review process completion indicator to Kotahi DocMaps API #834

name: CI Build
on:
push:
branches:
- develop
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- develop
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Build Image
run: make build
- name: Linting
run: make lint
- name: Unit Test
run: make unittest
docker-build-and-push:
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- name: Set tags
id: set_tags
run: |
DOCKER_IMAGE=ghcr.io/elifesciences/data-hub-api
VERSION=""
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
SHORT_SHA=${GITHUB_SHA::8}
TIMESTAMP=`date --utc +%Y%m%d.%H%M`
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:latest"
else
TAGS="${DOCKER_IMAGE}_unstable:${GITHUB_SHA},${DOCKER_IMAGE}_unstable:${GIT_BRANCH}-${SHORT_SHA}-${TIMESTAMP},${DOCKER_IMAGE}_unstable:latest"
fi
echo "TAGS=${TAGS}"
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (if not PR)
id: docker_build
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.set_tags.outputs.tags }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}