Fix production build #19
Workflow file for this run
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: Test - Build - Push | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: 'yarn' | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile | |
- name: Run Jest Tests | |
run: yarn test --collectCoverage=false | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Test Docker build | |
if: ${{ github.ref_name != 'main' }} | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64 | |
push: false # dont push image - Used to confirm build success on branches | |
file: docker/production/Dockerfile | |
- name: Login to DockerHub | |
if: ${{ github.ref_name == 'main' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push latest | |
if: ${{ github.ref_name == 'main' }} | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
file: docker/production/Dockerfile | |
tags: jembi/smart-health-links-portal:latest |