Skip to content

Running checks βœ… and deploying application πŸš€ #341

Running checks βœ… and deploying application πŸš€

Running checks βœ… and deploying application πŸš€ #341

name: Check, build and deploy
run-name: Running checks βœ… and deploying application πŸš€
on:
push:
branches:
- 'main'
jobs:
checks:
runs-on: ubuntu-latest
name: Pre-deployment checks
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
token: ${{ secrets.TW_CONFIDENTIAL_MATERIAL_PAT }}
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Yarn install
run: yarn install --frozen-lockfile
- name: Test
run: yarn run test
build_and_deploy_sites:
runs-on: ubuntu-latest
needs: checks
name: Build and deploy all sites
environment: deploy_${{ matrix.site }}
strategy:
matrix:
site: [ teach, gbsl ]
steps:
# TODO #5: Cache checkout / node setup / yarn install
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
token: ${{ secrets.TW_CONFIDENTIAL_MATERIAL_PAT }}
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Yarn install
run: yarn install --frozen-lockfile
- name: Build for site ${{ matrix.site }}
run: SITE=${{ matrix.site }} yarn run build
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
TENANT_ID: ${{ secrets.TENANT_ID }}
APP_URL: ${{ secrets.APP_URL }}
BACKEND_URL: ${{ secrets.BACKEND_URL }}
API_URI: ${{ secrets.API_URI }}
- name: RSync to webhost
uses: Burnett01/[email protected]
with:
switches: -avzr --delete
path: build/
remote_path: ~/sites/${{ matrix.site }}.silasberger.ch/
remote_host: ${{ secrets.WEBHOST_SSH_HOSTNAME }}
remote_user: ${{ secrets.WEBHOST_SSH_USERNAME }}
remote_key: ${{ secrets.WEBHOST_SSH_PRIVATE_KEY }}