kios-webapp/.github/workflows/push.yml

36 lines
1.4 KiB
YAML
Raw Normal View History

name: Clone or pull repository
on:
push:
branches:
- prod
jobs:
build:
name: Run remote SSH command
runs-on: ubuntu-latest
steps:
- name: Trigger build via ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER }}
key: ${{ secrets.KEY }}
script: |
if [ -d ${{ secrets.PATH }} ]; then
cd ${{ secrets.PATH }}
git pull
else
mkdir ${{ secrets.PATH }}
cd ${{ secrets.PATH }}
git clone -b prod https://github.com/${{ github.repository }} .
cp .env ./astro/.env
sed -i "s/ASTRO_URL=.*/ASTRO_URL=${{ vars.ASTRO_URL }}/" .env
sed -i "s/PAYLOAD_URL=.*/PAYLOAD_URL=${{ vars.PAYLOAD_URL }}/" .env
sed -i "s/PAYLOAD_PORT=.*/PAYLOAD_PORT=${{ secrets.PAYLOAD_PORT }}/" .env
sed -i "s/PAYLOAD_SECRET=.*/PAYLOAD_SECRET=${{ secrets.PAYLOAD_SECRET }}/" .env
sed -i "s/MONGODB_URI=.*/MONGODB_URI=${{ secrets.MONGODB_URI }}/" .env
sed -i "s/MONGODB_USER=.*/MONGODB_USER=${{ secrets.MONGODB_USER }}/" .env
sed -i "s/MONGODB_PW=.*/MONGODB_PW=${{ secrets.MONGODB_PW }}/" .env
sed -i "s/NAME=.*/NAME=${{ vars.NAME }}/" .env
fi
yarn prod