Skip to content

fix: materials used validation error on creating new project (#1126) #239

fix: materials used validation error on creating new project (#1126)

fix: materials used validation error on creating new project (#1126) #239

name: Frontend Production Deployment
on:
push:
branches:
- master
paths:
- "zubhub_frontend/zubhub/**"
- "!zubhub_frontend/zubhub/README.md"
- "!zubhub_frontend/zubhub/.env.example"
- "!zubhub_frontend/zubhub/.prettierrc.yaml"
- "!zubhub_frontend/zubhub/.gitignore"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: unstructuredstudio/zubhub/.github/actions/checkout@master
- name: Build and push frontend
uses: unstructuredstudio/zubhub/.github/actions/docker_build_and_push@master
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
token: ${{ secrets.DOCKERHUB_TOKEN }}
context: ./zubhub_frontend/zubhub/
file: ./zubhub_frontend/zubhub/Dockerfile.prod
push: true
tags: unstructuredstudio/zubhub-frontend:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: unstructuredstudio/zubhub/.github/actions/checkout@master
- uses: unstructuredstudio/zubhub/.github/actions/scp_action@master
with:
host: ${{ vars.DO_FRONTEND_HOST }}
username: ${{ vars.DO_FRONTEND_USERNAME }}
key: ${{ secrets.DO_SSHKEY }}
source: "."
target: "/home/zubhub-frontend/zubhub"
- uses: unstructuredstudio/zubhub/.github/actions/ssh_action@master
with:
host: ${{ vars.DO_FRONTEND_HOST }}
username: ${{ vars.DO_FRONTEND_USERNAME }}
key: ${{ secrets.DO_SSHKEY }}
script: |
cp /home/zubhub-frontend/zubhub/zubhub_frontend/zubhub/deploy_frontend.sh /home/zubhub-frontend/
sudo bash /home/zubhub-frontend/deploy_frontend.sh
prune:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Execute docker system prune on ${{ vars.DO_FRONTEND_HOST }}
uses: unstructuredstudio/zubhub/.github/actions/ssh_action@master
with:
host: ${{ vars.DO_FRONTEND_HOST }}
username: ${{ vars.DO_FRONTEND_USERNAME }}
key: ${{ secrets.DO_SSHKEY }}
script: |
docker system prune -a -f
volumes=$(docker volume ls -q)
# Loop through the volumes
while IFS= read -r volume; do
# Delete the volume if it doesn't end with "_data"
if [[ ! $volume =~ _data$ ]]; then
docker volume rm "$volume" 2> /dev/null || true
fi
done <<< "$volumes"