Skip to content

readme

readme #71

Workflow file for this run

name: Build
on:
push:
branches:
- main # This workflow will run when changes are pushed to the main branch
#find . -type f -name "*.mp3" -exec rm -f {} \; && git pull && pnpm install && pnpm run build && cp -r /home/thomas/caption-youtube/node_modules/ffmpeg-static/ /home/thomas/caption-youtube/.output/server/node_modules && pm2 restart YTSubs
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
- name: Install pnpm
run: npm install -g pnpm
- name: Install packages
run: pnpm install
- name: Create .env file
run: |
echo "DOMAIN=${{ secrets.DOMAIN }}" > .env
echo "PATH_TO_STORE_TEMP_FILES=${{ secrets.PATH_TO_STORE_TEMP_FILES }}" >> .env
echo "PATH_TO_DOWNLOAD_FILES=${{ secrets.PATH_TO_DOWNLOAD_FILES }}" >> .env
echo "POSTHOG_PUBLIC_KEY=${{ secrets.POSTHOG_PUBLIC_KEY }}" >> .env
echo "POSTHOG_HOST=${{ secrets.POSTHOG_HOST }}" >> .env
- name: Build
run: pnpm run build
- name: Copy binaries
run: cp -r ./node_modules/ffmpeg-static/ .output/server/node_modules && cp -r ./node_modules/fluent-ffmpeg/ .output/server/node_modules
- name: Deploy to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USER }}
password: ${{ secrets.SERVER_PASSWORD }}
source: ".output"
target: "${{ secrets.PROJECT_PATH }}"
- name: Restart PM2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USER }}
password: ${{ secrets.SERVER_PASSWORD }}
script: |
cd ${{ secrets.PROJECT_PATH }}
find . -type f -name "*.mp3" -exec rm -f {} \;
pm2 restart YTSubs