jan/.github/workflows/ci-production.yml
hiento09 a251a32528
Add CI for Jan-cloud (#69)
* Add CI staging for Jan-cloud

* Update web-client/Dockerfile

switch from npm to yarn command

Co-authored-by: Louis <133622055+louis-jan@users.noreply.github.com>

* Update web-client/Dockerfile

Correct yarn build command

Co-authored-by: Louis <133622055+louis-jan@users.noreply.github.com>

---------

Co-authored-by: Hien To <tominhhien97@gmail.com>
Co-authored-by: Louis <133622055+louis-jan@users.noreply.github.com>
2023-09-07 10:21:06 +07:00

54 lines
1.7 KiB
YAML

name: Jan CI Production
on:
push:
tags: ['v*.*.*']
env:
REGISTRY: ghcr.io
HASURA_WORKER_IMAGE_NAME: ${{ github.repository }}/worker
WEB_CLIENT_IMAGE_NAME: ${{ github.repository }}/web-client
jobs:
build-docker-image:
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
packages: write
steps:
- name: Getting the repo
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
# Build and docker image for app-backend worker
- name: Build docker image for app-backend worker
run: |
cd ./app-backend/worker
docker build -t ${{ env.REGISTRY }}/${{ env.HASURA_WORKER_IMAGE_NAME }}:${{ steps.tag.outputs.tag }} .
docker push ${{ env.REGISTRY }}/${{ env.HASURA_WORKER_IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
# Get .env for FE
- name: Get .env file for build time
run: cd ./web-client && base64 -d <<< "$ENV_FILE_BASE64" > .env
shell: bash
env:
ENV_FILE_BASE64: ${{ secrets.ENV_FILE_BASE64 }}
# Build and push docker for web client
- name: Build docker image for web-client
run: |
cd ./web-client
docker build -t ${{ env.REGISTRY }}/${{ env.WEB_CLIENT_IMAGE_NAME }}:${{ steps.tag.outputs.tag }} .
docker push ${{ env.REGISTRY }}/${{ env.WEB_CLIENT_IMAGE_NAME }}:${{ steps.tag.outputs.tag }}