Skip to content

Merge remote-tracking branch 'origin/fix-docx-book-repeat-issue' into… #721

Merge remote-tracking branch 'origin/fix-docx-book-repeat-issue' into…

Merge remote-tracking branch 'origin/fix-docx-book-repeat-issue' into… #721

name: Docker
on: [push, pull_request]
jobs:
#build and publish image
Build-API-Image:
name: Build API image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: FranzDiebold/github-env-vars-action@v2
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Build API image with buildx
uses: docker/build-push-action@v3
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
Build-Frontend-Image:
name: Build Frontend image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: FranzDiebold/github-env-vars-action@v2
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Build frontend image
uses: docker/build-push-action@v3
with:
context: ./frontend
cache-from: type=gha
cache-to: type=gha,mode=max
Test-API-Image:
name: Test API image
runs-on: ubuntu-20.04
needs: Build-API-Image
steps:
- uses: actions/checkout@v3
- uses: FranzDiebold/github-env-vars-action@v2
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Build API image with buildx
uses: docker/build-push-action@v3
with:
context: .
tags: wycliffeassociates/doc:local
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test API image with docker-compose
run: |
docker compose -f docker-compose.yml -f docker-compose.api-test.yml up --exit-code-from test-runner
Test-Frontend-Image:
name: Test Frontend image
runs-on: ubuntu-20.04
needs: [Build-API-Image, Build-Frontend-Image]
steps:
- uses: actions/checkout@v3
- uses: FranzDiebold/github-env-vars-action@v2
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Build api image
uses: docker/build-push-action@v3
with:
context: .
tags: wycliffeassociates/doc:local
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build frontend image
uses: docker/build-push-action@v3
with:
context: ./frontend
tags: wycliffeassociates/doc-ui:local
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build frontend-tests image
uses: docker/build-push-action@v3
with:
context: ./frontend
file: ./frontend/testsDockerfile
tags: wycliffeassociates/doc-ui-tests:local
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test frontend image with docker-compose
run: docker compose -f docker-compose.yml -f docker-compose.frontend-test.yml up --exit-code-from frontend-test-runner
Push-Images:
name: Push images if this is a branch
runs-on: ubuntu-20.04
needs: [Test-API-Image, Test-Frontend-Image]
if: ${{ contains(fromJson('["push"]'), github.event_name) }}
steps:
- uses: actions/checkout@v3
- uses: FranzDiebold/github-env-vars-action@v2
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Set DOC docker tags
run: |
echo "DOC_TAG_SHA=wycliffeassociates/doc:$GITHUB_SHA" >> $GITHUB_ENV && \
echo "DOC_TAG_BRANCH=wycliffeassociates/doc:$CI_REF_NAME_SLUG" >> $GITHUB_ENV && \
echo "DOC_TAG_LATEST=wycliffeassociates/doc:latest" >> $GITHUB_ENV
- name: Set DOC-UI docker tags
run: |
echo "DOC_UI_TAG_SHA=wycliffeassociates/doc-ui:$GITHUB_SHA" >> $GITHUB_ENV && \
echo "DOC_UI_TAG_BRANCH=wycliffeassociates/doc-ui:$CI_REF_NAME_SLUG" >> $GITHUB_ENV && \
echo "DOC_UI_TAG_LATEST=wycliffeassociates/doc-ui:latest" >> $GITHUB_ENV
- name: Set version inside UI
run: |
PUBLIC_DOC_BUILD_TIMESTAMP=$(TZ='America/New_York' date +"%m-%d-%Y")
echo "PUBLIC_DOC_BUILD_TIMESTAMP=$PUBLIC_DOC_BUILD_TIMESTAMP" >> $GITHUB_ENV
echo "PUBLIC_DOC_VERSION=$CI_SHA_SHORT" >> $GITHUB_ENV
- name: Build and conditional push API image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
${{ env.DOC_TAG_SHA }}
${{ env.DOC_TAG_BRANCH }}
${{ env.DOC_TAG_LATEST }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and conditional push UI image
uses: docker/build-push-action@v3
with:
context: ./frontend
push: true
tags: |
${{ env.DOC_UI_TAG_SHA }}
${{ env.DOC_UI_TAG_BRANCH }}
${{ env.DOC_UI_TAG_LATEST }}
build-args: |
PUBLIC_DOC_VERSION_ARG=${{ env.PUBLIC_DOC_VERSION }}
PUBLIC_DOC_BUILD_TIMESTAMP_ARG=${{ env.PUBLIC_DOC_BUILD_TIMESTAMP }}
cache-from: type=gha
cache-to: type=gha,mode=max
Deploy-develop:
name: Develop deploy on successful develop build
needs: [Push-Images]
if: ${{ github.ref_name == 'doc-dev.walink.org' }}
runs-on: ubuntu-20.04
environment: doc-dev.walink.org
steps:
- name: Configure 1Password Service Account
uses: 1password/load-secrets-action@v1
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
DEV_DEPLOY_HOOK: op://DevOps/DEPLOY-doc-dev-walink-org-token/url
- name: Call Deploy Webhook
run: curl ${{ env.DEV_DEPLOY_HOOK }}