Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
added preview deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfactor committed Mar 13, 2024
1 parent 39c4d0b commit b51cbb9
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build and Deploy

on:
push:
branches:
- 'preview'

jobs:
build:
runs-on: ubuntu-latest
env:
REMOTE_SERVER: ${{ secrets.REMOTE_SERVER }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
MD_DOCS_FOLDER: ${{ github.workspace }}/nightwatch-docs
API_DOCS_FOLDER: ${{ github.workspace }}/nightwatch/lib/api

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Checkout Nightwatch source code
uses: actions/checkout@v2
with:
repository: nightwatchjs/nightwatch
path: nightwatch

- name: Checkout Nightwatch docs folder
uses: actions/checkout@v2
with:
repository: nightwatchjs/nightwatch-docs
ref: versions/3.0
path: nightwatch-docs

# - name: Delete not needed files
# run: |
# rm ${{ github.workspace }}/nightwatch-docs/LICENSE.md
# rm ${{ github.workspace }}/nightwatch-docs/README.md

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Install dependencies
run: npm install

- name: Prebuild #required ensure api pages are generated before the ejs files are processed
run: npm run prebuild

- name: Build the website
run: npm run build

- name: Creating symlinks to old version
run: |
ln -s ../nightwatchjs.org out/v17
ln -s ../v09.nightwatchjs.org out/v09
ln -s ../nightwatch-v26 out/v26
- name: Deploy to server
run: |
mkdir -p ~/.ssh
echo "${{ secrets.PROD_DEPLOY_SECRET }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan ${{ env.REMOTE_SERVER }} >> ~/.ssh/known_hosts
rsync -azP --delete ./out/ ${{ env.REMOTE_USER }}@${{ env.REMOTE_SERVER }}:${{ secrets.REMOTE_PREVIEW_DIRECTORY }}

0 comments on commit b51cbb9

Please sign in to comment.