Skip to content

Push production to server #18

Push production to server

Push production to server #18

name: Push production to server
on:
workflow_dispatch:
push:
branches:
- main
jobs:
deploy:
name: Build & Deploy
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: npm ci
- name: Create .env with Github Secrets and run script
run: |
touch .env
echo GATSBY_BACKEND_URL=$GATSBY_BACKEND_URL >> .env
echo STRAPI_TOKEN=$STRAPI_TOKEN >> .env
env:
GATSBY_BACKEND_URL: 'https://backend.plan-f.info'
STRAPI_TOKEN: ${{ secrets.STRAPI_TOKEN }}
- run: npm run build
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: '0ß2ndghg923hfgogz0hwlcjfg9iot'
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts
- run: rsync -avz --delete ./public/ .htaccess ${{ secrets.USERNAME }}@${{ secrets.HOST }}:${{ secrets.TARGET }}