Skip to content

Build/Deploy to Staging #320

Build/Deploy to Staging

Build/Deploy to Staging #320

name: Build/Deploy to Staging
on:
workflow_dispatch: # this makes the action manual
jobs:
neon:
name: Build Neon
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
working-directory: ./neon
run: npm install
# Copy node modules to provide dependencies for shared components in root folder
- name: Copy node_modules
shell: bash
run: |
cp -r neon/node_modules .
ls -la
- name: Make build
working-directory: ./neon
run: npm run docs:build
- name: Upload
uses: actions/upload-artifact@v3
with:
name: neon
path: neon/.vitepress/dist
invisible:
name: Build Invisible
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
working-directory: ./invisible
run: npm install
# Copy node modules to provide dependencies for shared components in root folder
- name: Copy node_modules
shell: bash
run: |
cp -r invisible/node_modules .
ls -la
- name: Make build
working-directory: ./invisible
run: npm run docs:build
- name: Upload
uses: actions/upload-artifact@v3
with:
name: invisible
path: invisible/.vitepress/dist
core:
name: Build Core
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
working-directory: ./core
run: npm install
# Copy node modules to provide dependencies for shared components in root folder
- name: Copy node_modules
shell: bash
run: |
cp -r core/node_modules .
ls -la
- name: Make build
working-directory: ./core
run: npm run docs:build
- name: Upload
uses: actions/upload-artifact@v3
with:
name: core
path: core/.vitepress/dist
alpha-lab:
name: Build Alpha Lab
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
working-directory: ./alpha-lab
run: npm install
# Copy node modules to provide dependencies for shared components in root folder
- name: Copy node_modules
shell: bash
run: |
cp -r alpha-lab/node_modules .
ls -la
- name: Make build
working-directory: ./alpha-lab
run: npm run docs:build
- name: Upload
uses: actions/upload-artifact@v3
with:
name: alpha-lab
path: alpha-lab/.vitepress/dist
landing-page:
name: Upload landing page
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
working-directory: ./landing-page
run: npm install
# Copy node modules to provide dependencies for shared components in root folder
- name: Copy node_modules
shell: bash
run: |
cp -r landing-page/node_modules .
ls -la
- name: Make build
working-directory: ./landing-page
run: npm run docs:build
- name: Upload
uses: actions/upload-artifact@v3
with:
name: landing-page
path: landing-page/.vitepress/dist
debugging-info:
name: Upload debugging info
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Write commit SHA to gitcommit.txt
shell: bash
run: |
echo $GITHUB_SHA > gitcommit.txt
- name: Gitcommit - upload
uses: actions/upload-artifact@v3
with:
name: gitcommit
path: gitcommit.txt
deploy-staging:
name: Deploy to staging
runs-on: ubuntu-latest
environment:
name: staging
url: https://docs-staging.pupil-labs.com
needs: [neon, invisible, core, landing-page, alpha-lab, debugging-info]
steps:
- uses: actions/checkout@v3
- name: Get size of files
shell: bash
run: |
du -ah .
- name: Download gitcommit
uses: actions/download-artifact@v3
with:
name: gitcommit
path: gitcommit.txt
- name: Download Neon
uses: actions/download-artifact@v3
with:
name: neon
path: neon/
- name: Download Invisible
uses: actions/download-artifact@v3
with:
name: invisible
path: invisible/
- name: Download Core
uses: actions/download-artifact@v3
with:
name: core
path: core/
- name: Download AlphaLab
uses: actions/download-artifact@v3
with:
name: alpha-lab
path: alpha-lab/
- name: Download Landing Page
uses: actions/download-artifact@v3
with:
name: landing-page
- name: Rsync action - Deploy to staging
uses: burnett01/[email protected]
with:
switches: -hrvz --delete --exclude=".htaccess"
path: .
remote_path: ${{ secrets.REMOTE_PATH }}
remote_host: ${{ secrets.REMOTE_HOST}}
remote_user: ${{ secrets.REMOTE_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}