Bump action version #250
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: CI | |
on: | |
push: | |
jobs: | |
build-server: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3-beta | |
with: | |
node-version: '16' | |
- run: | | |
(cd ui && npm install && npm run build_lib && npm run package) | |
- env: | |
DOCKER_IMAGE_NAME: "akariv/dgp-app" | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
if docker pull "${DOCKER_IMAGE_NAME}:latest"; then | |
CACHE_FROM_ARG="--cache-from ${DOCKER_IMAGE_NAME}:latest" | |
else | |
CACHE_FROM_ARG="" | |
fi &&\ | |
docker build $CACHE_FROM_ARG -t server . &&\ | |
docker tag server "${DOCKER_IMAGE_NAME}:${GITHUB_SHA}" &&\ | |
echo "${DOCKER_PASSWORD}" | docker login -u ${DOCKER_USERNAME} --password-stdin &&\ | |
docker push "${DOCKER_IMAGE_NAME}:${GITHUB_SHA}" &&\ | |
if [ "${GITHUB_REF}" == "refs/heads/master" ]; then | |
docker tag server "${DOCKER_IMAGE_NAME}:latest" &&\ | |
docker push "${DOCKER_IMAGE_NAME}:latest" | |
fi | |
- env: | |
DOCKER_IMAGE_NAME: "akariv/dgp-app-db" | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
echo "${DOCKER_PASSWORD}" | docker login -u ${DOCKER_USERNAME} --password-stdin &&\ | |
if docker pull "${DOCKER_IMAGE_NAME}:latest"; then | |
CACHE_FROM_ARG="--cache-from ${DOCKER_IMAGE_NAME}:latest" | |
else | |
CACHE_FROM_ARG="" | |
fi &&\ | |
docker build $CACHE_FROM_ARG -t db db &&\ | |
docker tag server "${DOCKER_IMAGE_NAME}:${GITHUB_SHA}" &&\ | |
docker push "${DOCKER_IMAGE_NAME}:${GITHUB_SHA}" &&\ | |
if [ "${GITHUB_REF}" == "refs/heads/master" ]; then | |
docker tag db "${DOCKER_IMAGE_NAME}:latest" &&\ | |
docker push "${DOCKER_IMAGE_NAME}:latest" | |
fi |