Updated CI/CD Tests #6
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: Deployment | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy-web: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout workspace | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Debug - List directory structure | |
run: | | |
ls -R | |
- name: Install dependencies and run lint checks | |
run: | | |
cd src/website | |
npm ci | |
npm run lint | |
- name: Build website | |
run: | | |
cd src/website | |
npm run build | |
- name: Update docker image | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
[ ! -d "sailbot_workspace" ] && git clone https://github.com/UBCSailbot/sailbot_workspace.git | |
cd sailbot_workspace | |
git pull | |
touch src/website/.env.local # Adds a local environment file to VM to override env vars in .env.production | |
echo NEXT_PUBLIC_SERVER_HOST=http://${{ secrets.SSH_HOST }} >> src/website/.env.local | |
docker compose -f .devcontainer/docker-compose.yml -f .devcontainer/website/docker-compose.website.prod.yml up --force-recreate -d --build --remove-orphans |