fix(ci): path for backend docs #76
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: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy-frontend: | |
name: Deploy Frontend | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Install dependencies | |
run: yarn | |
working-directory: ./website | |
- name: Build | |
run: yarn build | |
env: | |
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }} | |
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }} | |
OAUTH_REDIRECT_URI: ${{ secrets.OAUTH_REDIRECT_URI }} | |
DB_URL: ${{ secrets.DB_URL }} | |
working-directory: ./website | |
- name: Remove old files from server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_SERVER_NAME }} | |
username: ${{ secrets.SSH_SERVER_USERNAME }} | |
password: ${{ secrets.SSH_SERVER_PASS }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
script: | | |
rm -rf ${{ secrets.SSH_SERVER_FRONTEND_PATH }}* | |
- name: Deploy frontend to server | |
uses: wlixcc/[email protected] | |
with: | |
username: ${{ secrets.SSH_SERVER_USERNAME }} | |
server: ${{ secrets.SSH_SERVER_NAME }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
password: ${{ secrets.SSH_SERVER_PASS }} | |
local_path: "./website/dist/*" | |
remote_path: ${{ secrets.SSH_SERVER_FRONTEND_PATH }} | |
deploy-backend: | |
name: Deploy Backend | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Remove old files from server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_SERVER_NAME }} | |
username: ${{ secrets.SSH_SERVER_USERNAME }} | |
password: ${{ secrets.SSH_SERVER_PASS }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
script: | | |
rm -rf ${{ secrets.SSH_SERVER_BACKEND_PATH }}* | |
- name: Deploy backend to server | |
uses: wlixcc/[email protected] | |
with: | |
username: ${{ secrets.SSH_SERVER_USERNAME }} | |
server: ${{ secrets.SSH_SERVER_NAME }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
password: ${{ secrets.SSH_SERVER_PASS }} | |
local_path: "./backend/*" | |
remote_path: ${{ secrets.SSH_SERVER_BACKEND_PATH }} | |
- name: Create .env file | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_SERVER_NAME }} | |
username: ${{ secrets.SSH_SERVER_USERNAME }} | |
password: ${{ secrets.SSH_SERVER_PASS }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
script: | | |
cd ${{ secrets.SSH_SERVER_BACKEND_PATH }} | |
echo -e 'OAUTH_CLIENT_ID="${{ secrets.OAUTH_CLIENT_ID }}"\nOAUTH_CLIENT_SECRET="${{ secrets.OAUTH_CLIENT_SECRET }}"\nOAUTH_REDIRECT_URI="${{ secrets.OAUTH_REDIRECT_URI }}"\nDB_URL="${{ secrets.DB_URL }}"\nSTRIPE_PUBLISHABLE_KEY="${{ secrets.STRIPE_PUBLISHABLE_KEY }}"\nSTRIPE_SECRET_KEY="${{ secrets.STRIPE_SECRET_KEY }}"\nSTRIPE_SUCCESS_KEY="${{ secrets.STRIPE_SUCCESS_KEY }}"' > .env | |
- name: Run backend | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_SERVER_NAME }} | |
username: ${{ secrets.SSH_SERVER_USERNAME }} | |
password: ${{ secrets.SSH_SERVER_PASS }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
script: | | |
cd ${{ secrets.SSH_SERVER_BACKEND_PATH }} | |
bun install | |
screen -S fitplanconnect-backend -X quit | |
screen -S fitplanconnect-backend -d -m bun run dev | |
exit | |
deploy-backend-docs: | |
name: Deploy Backend Documentation | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Remove old files from server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_SERVER_NAME }} | |
username: ${{ secrets.SSH_SERVER_USERNAME }} | |
password: ${{ secrets.SSH_SERVER_PASS }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
script: | | |
rm -rf ${{ secrets.SSH_SERVER_BACKEND_DOCS_PATH }}* | |
- name: Deploy backend docs to server | |
uses: wlixcc/[email protected] | |
with: | |
username: ${{ secrets.SSH_SERVER_USERNAME }} | |
server: ${{ secrets.SSH_SERVER_NAME }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
password: ${{ secrets.SSH_SERVER_PASS }} | |
local_path: "./backend/*" | |
remote_path: ${{ secrets.SSH_SERVER_BACKEND_DOCS_PATH }} | |
- name: Create .env file | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_SERVER_NAME }} | |
username: ${{ secrets.SSH_SERVER_USERNAME }} | |
password: ${{ secrets.SSH_SERVER_PASS }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
script: | | |
cd ${{ secrets.SSH_SERVER_BACKEND_DOCS_PATH }} | |
echo -e 'OAUTH_CLIENT_ID="${{ secrets.OAUTH_CLIENT_ID }}"\nOAUTH_CLIENT_SECRET="${{ secrets.OAUTH_CLIENT_SECRET }}"\nOAUTH_REDIRECT_URI="${{ secrets.OAUTH_REDIRECT_URI }}"\nDB_URL="${{ secrets.DB_URL }}"\nSTRIPE_PUBLISHABLE_KEY="${{ secrets.STRIPE_PUBLISHABLE_KEY }}"\nSTRIPE_SECRET_KEY="${{ secrets.STRIPE_SECRET_KEY }}"\nSTRIPE_SUCCESS_KEY="${{ secrets.STRIPE_SUCCESS_KEY }}"' > .env | |
- name: Run backend documentation | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_SERVER_NAME }} | |
username: ${{ secrets.SSH_SERVER_USERNAME }} | |
password: ${{ secrets.SSH_SERVER_PASS }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
script: | | |
cd ${{ secrets.SSH_SERVER_BACKEND_DOCS_PATH }} | |
bun install | |
screen -S fitplanconnect-backend-docs -X quit | |
screen -S fitplanconnect-backend-docs -d -m bun run dev | |
exit |