Skip to content

Commit

Permalink
Update workflow for lethe dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
aradhanas9 committed Jun 6, 2024
1 parent e684ba8 commit f8a52c2
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions .github/workflows/doc.nuxeo.com.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
name: Build and Deploy doc.nuxeo.com

on:
push:
branches:
- master
- development
schedule:
- cron: '0 0 * * *' # Every night at midnight
workflow_dispatch: # Manual triggering

jobs:
documentation_ci:
name: Build & Publish documentation to ${{ github.ref_name == 'master' && 'production' || 'development' }}
runs-on: doc
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name == 'master' && 'production' || 'development' }}
steps:

- name: Configure SSH client
run: |
echo "$SSH_CONFIG" >> $HOME/.ssh/config
env:
SSH_CONFIG: "${{ secrets.SSH_CONFIG }}"

- name: Set up SSH
uses: webfactory/ssh-agent@d4b9b8ff72958532804b70bbe600ad43b36d5f2e # v0.8.0
- 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:
ssh-private-key: ${{ secrets.SERVER_SSH_PRIVATE_KEY }}
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
Expand Down Expand Up @@ -59,14 +57,13 @@ jobs:
- name: Deploy to Server
run: |
rsync -Wxvurk --delete site/ "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/opt/www/doc/"
rsync redirects.txt "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects.txt"
rsync redirects_pageid.txt ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects_pageid.txt
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: Nginx Config Test and Restart
run: |
ssh "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}" \
"service nginx configtest && service nginx restart"
ssh -o StrictHostKeyChecking=no -T lethe.nuxeo.com "apache2ctl configtest && service apache2 restart"
- name: Archive Artifacts
uses: actions/upload-artifact@v3
Expand Down

0 comments on commit f8a52c2

Please sign in to comment.