Skip to content

feat: add basic layout for astro #217

feat: add basic layout for astro

feat: add basic layout for astro #217

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
jobs:
build-push-frontend:
name: Build and Push Frontend Container
runs-on: ubuntu-latest
environment:
name: prod
env:
PRIVATE_OUTLINE_SERVER: ${{ secrets.PRIVATE_OUTLINE_SERVER }}
PRIVATE_OUTLINE_API_TOKEN: ${{ secrets.PRIVATE_OUTLINE_API_TOKEN }}
PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }}
PUBLIC_URL: ${{ secrets.PUBLIC_URL }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Setup Dependencies
uses: ./.github/composite-actions/setup
- name: Build Frontend
run: echo $PUBLIC_URL && echo $PUBLIC_API_URL && pnpm nx build client
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: registry.ham-san.net
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and Push frontend image
uses: docker/build-push-action@v5
with:
file: ./apps/client/Dockerfile
context: .
push: true
tags: registry.ham-san.net/ham-san-net-client:latest
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
build-push-backend:
name: Build and Push Backend Container
runs-on: ubuntu-latest
environment:
name: prod
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Setup Dependencies
uses: ./.github/composite-actions/setup
- name: Build Backend
run: pnpm nx build api
- name: Login to Registry (Again just in case)
uses: docker/login-action@v3
with:
registry: registry.ham-san.net
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push backend image
uses: docker/build-push-action@v5
with:
file: ./apps/api/Dockerfile
context: ./dist/apps/api
push: true
tags: registry.ham-san.net/ham-san-net-api:latest
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
Deploy:
name: Deploy to VM
needs:
- build-push-frontend
- build-push-backend
runs-on: ubuntu-latest
environment:
name: prod
url: https://ham-san.net
steps:
- name: Deploy to VM via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
eval "$(ssh-agent -s)"
ssh-add - <<< "${{ secrets.GH_PRIVATE_KEY }}"
cd ./ham-san-net
git pull origin main
./pre-deploy.sh
- name: Deploy Backend
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
cd ./ham-san-net
./deploy-backend.sh
- name: Deploy Frontend
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
cd ./ham-san-net
./deploy-frontend.sh
- name: Running Page Speed Insights
uses: jakepartusch/[email protected]
id: psi
with:
url: ${{ secrets.PUBLIC_URL }}
threshold: 70
strategy: mobile
key: ${{ secrets.PSI_API_KEY }}