70 lines
No EOL
1.9 KiB
YAML
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 }} |