v1.0.23 #12
Workflow file for this run
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: Deploy to VPS Server | |
on: | |
release: | |
types: [created] | |
jobs: | |
lint: | |
name: Lint files | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Lint files | |
run: yarn lint | |
- name: Typecheck files | |
run: npx tsc | |
build-app: | |
name: Build Application | |
runs-on: ubuntu-latest | |
needs: [lint] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Build the Next.js app | |
run: yarn build | |
env: | |
G_USER: ${{ secrets.G_USER }} | |
G_TOKEN: ${{ secrets.G_TOKEN }} | |
deploy: | |
name: Deploy to VPS Server | |
runs-on: ubuntu-latest | |
needs: [build-app] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up SSH key | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
SSH_VPS_IP: ${{ secrets.SSH_VPS_IP }} | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan -H "$SSH_VPS_IP" >> ~/.ssh/known_hosts | |
- name: Deploy via SSH | |
env: | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_VPS_IP: ${{ secrets.SSH_VPS_IP }} | |
run: | | |
ssh -i ~/.ssh/id_rsa "$SSH_USER"@"$SSH_VPS_IP" " | |
cd rnstudio.hu && | |
git pull origin main && | |
yarn install && | |
yarn build && | |
pm2 restart nextjs-app | |
" |