Update doc.nuxeo.com.yml #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy doc.nuxeo.com | |
on: | |
push: | |
branches: | |
- master | |
- development | |
jobs: | |
documentation_ci: | |
name: Build & Publish documentation to ${{ github.ref_name == 'master' && 'production' || 'development' }} | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.ref_name == 'master' && 'production' || 'development' }} | |
steps: | |
- name: Install SSH key for Bastion | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.DEV_TOOLS_BASTION_PRIVATE_KEY }} | |
name: id_rsa-bastion | |
known_hosts: ${{ secrets.KNOWN_HOSTS_OF_BASTION }} | |
config: ${{ secrets.CONFIG }} | |
- name: Install SSH key of target | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.DEV_TOOLS_EC2_PRIVATE_KEY }} | |
name: id_rsa-target | |
known_hosts: ${{ secrets.KNOWN_HOSTS_OF_TARGET }} | |
config: ${{ secrets.CONFIG }} | |
- name: Checkout code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Set up Node.js | |
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 | |
with: | |
node-version: '14' | |
- name: Check Versions and Save to File | |
run: | | |
echo "git $(git --version)" > runtime-versions.txt | |
echo "node version $(node --version)" >> runtime-versions.txt | |
echo "npm version $(npm --version)" >> runtime-versions.txt | |
echo "IP $(curl -s ipinfo.io/ip)" >> runtime-versions.txt | |
- name: Install dependencies | |
run: npm ci --registry="https://registry.npmjs.org" || npm install --registry="https://registry.npmjs.org" | |
- name: Build | |
env: | |
ALGOLIA_KEY: ${{ secrets.NX_TOKEN }} | |
DEBUG_FILE_LEVEL: debug | |
run: npm start | |
- name: Generate Nginx Redirects | |
run: | | |
bin/redirects-yml2nginx > redirects.txt | |
echo > redirects_pageid.txt | |
- name: Deploy to Server | |
run: | | |
rsync -Wxvurk --delete site/ "ssh -o StrictHostKeyChecking=no" -vz lethe.nuxeo.com:"/opt/www/doc/" | |
rsync redirects.txt "ssh -o StrictHostKeyChecking=no" -vz lethe.nuxeo.com:"/etc/apache2/redirects.txt" | |
rsync redirects_pageid.txt "ssh -o StrictHostKeyChecking=no" -vz lethe.nuxeo.com:"/etc/apache2/redirects_pageid.txt" | |
- name: Apache Config Test and Restart | |
run: | | |
ssh -o StrictHostKeyChecking=no -T lethe.nuxeo.com "apache2ctl configtest && service apache2 restart" | |
- name: Archive Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifacts | |
path: | | |
redirects_pageid.* | |
redirects.* | |
*.txt | |
npm-debug.log |