Coming soon (#281) #69
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: Deploy Frontend | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
defaults: | |
run: | |
working-directory: ./frontend | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # to get all tags | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Install packages | |
run: yarn install | |
- name: Build app | |
run: yarn build | |
- name: Deploy to gh-pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
clean: true | |
folder: frontend/dist | |
clean-exclude: docs | |
# also create an image based off of nginx with the frontend baked in | |
# (copied from ./build-image.yaml, with modifications) | |
- name: Generate Image Tag for Frontend Dir | |
id: get-tag | |
run: | | |
REV=$(git rev-list --tags --max-count=1 ) | |
IMAGE_TAG=$(git describe --tags $REV) | |
echo "IMAGE_TAG=${IMAGE_TAG//v}" | |
echo "IMAGE_TAG=${IMAGE_TAG//v}" >> $GITHUB_OUTPUT | |
# the monarch-ui Dockerfile pulls from two places: | |
# ./frontend/dist/, copied to /var/www/ in the image | |
# ./services/nginx/config/, copied to /etc/nginx/conf.d/ in the image | |
- name: Build and Push Image | |
uses: RafikFarhad/push-to-gcr-github-action@v5-beta | |
with: | |
gcloud_service_key: ${{ secrets.JSON_GCLOUD_SERVICE_ACCOUNT_JSON }} # not needed if you use google-github-actions/auth | |
registry: us-central1-docker.pkg.dev | |
project_id: monarch-initiative | |
image_name: monarch-api/monarch-ui | |
image_tag: latest, ${{ steps.get-tag.outputs.IMAGE_TAG }} | |
dockerfile: ./services/nginx/Dockerfile | |
context: . |