Add workflow to build app #2
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: Build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
CONTAINER_REGISTRY: ghcr.io | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build app | |
run: | | |
cd app | |
yarn install --immutable | |
yarn tsc | |
yarn build:backend --config ../../app-config.yaml --config ../../app-config.production.yaml | |
- name: Get Docker image tag | |
id: image_tags | |
run: | | |
echo "tag=$CONTAINER_REGISTRY/$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]'):$GITHUB_SHA" >> $GITHUB_OUTPUT | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.CONTAINER_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker build | |
run: | | |
cd app && docker build . --tag | |
docker push $TAG | |
env: | |
TAG: ${{ steps.image_tags.outputs.tag }} |