teasanctuary.ru/.forgejo/workflows/deploy.yaml
Ivan Kuzmenko 74baf8c854
All checks were successful
/ build (push) Successful in 3m47s
/ deploy (push) Successful in 51s
Попытка исправить ссылку на сообщество в Discord
2025-07-19 03:09:45 +03:00

70 lines
No EOL
1.9 KiB
YAML

on:
push:
branches:
- master
jobs:
build:
runs-on: docker
container:
image: docker.io/library/node:24
steps:
- name: Install Git
run: apt update && apt install -y git
- name: Checkout code
uses: actions/checkout@v4
- name: Restore the NPM cache
id: tsru-npm
uses: https://data.forgejo.org/actions/cache/restore@v4
with:
path: |
./node_modules
key: node_modules
- name: Install dependencies
run: npm i --include=dev
- name: Preserve the NPM packages
uses: https://data.forgejo.org/actions/cache/save@v4
with:
path: |
./node_modules
key: ${{ steps.tsru-npm.outputs.cache-primary-key }}
- name: Populate the .env file
run: echo "TEST PUBLIC_TS_DISCORD=${{ vars.PUBLIC_TS_DISCORD }}"; echo "PUBLIC_TS_DISCORD=${{ vars.PUBLIC_TS_DISCORD }}" >> .env
- name: Build frontend
run: npm run build
- uses: actions/upload-artifact@v3
with:
name: website
path: build/
deploy:
needs: [build]
runs-on: docker
steps:
- name: Install rsync
run: apt update && apt install -y rsync
- uses: actions/download-artifact@v3
with:
name: website
path: build/
- name: Add the private key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_PRIVATE_KEY }}" > ~/.ssh/id_deploy
chmod 600 ~/.ssh/id_deploy
- name: Make the known_hosts file
run: |
ssh-keyscan -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_ADDRESS }} >> ~/.ssh/known_hosts
- name: Upload folder with rsync
run: |
rsync -rvz --delete -e "ssh -p ${{ secrets.DEPLOY_PORT }} -i ~/.ssh/id_deploy" ./build/ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_ADDRESS }}:${{ secrets.DEPLOY_TARGET_FOLDER }}