2023-05-17 10:27:22 +00:00
|
|
|
name: Clone or pull repository
|
|
|
|
on:
|
2023-05-17 10:34:32 +00:00
|
|
|
push:
|
|
|
|
branches:
|
2023-05-17 16:21:45 +00:00
|
|
|
- main
|
2023-05-17 10:27:22 +00:00
|
|
|
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: |
|
2023-05-17 14:27:48 +00:00
|
|
|
if [ -d ${{ secrets.PATH }} ]; then
|
|
|
|
cd ${{ secrets.PATH }}
|
|
|
|
git pull
|
|
|
|
else
|
|
|
|
mkdir ${{ secrets.PATH }}
|
|
|
|
cd ${{ secrets.PATH }}
|
2023-05-17 16:21:45 +00:00
|
|
|
git clone https://github.com/${{ github.repository }} .
|
2023-05-17 15:03:20 +00:00
|
|
|
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
|
2023-05-17 16:52:14 +00:00
|
|
|
sed -i "s/TOKEN=.*/TOKEN=${{ secrets.TOKEN }}/" .env
|
2023-05-17 15:03:20 +00:00
|
|
|
sed -i "s/NAME=.*/NAME=${{ vars.NAME }}/" .env
|
2023-05-17 16:00:40 +00:00
|
|
|
cp .env ./astro/.env
|
2023-05-17 14:27:48 +00:00
|
|
|
fi
|
2023-05-17 16:03:20 +00:00
|
|
|
yarn prod payload
|
2023-05-17 16:21:45 +00:00
|
|
|
sleep 10
|
2023-05-17 16:03:20 +00:00
|
|
|
yarn prod astro
|