Skip to content

Commit

Permalink
Sync dev to main (#12)
Browse files Browse the repository at this point in the history
* Basic changes to test local config

Include YAML for automated deployment, and README

Include deploy script to alternate server

Improve the deploy script

Create docs-ci.yml (#6)

Update the Main CI

Improve the deploy script, fix null Key value

Fix YML duplication

Fix YML duplication

Include config update and deployment

Include config update and deployment, fix relative path

Fix file tree

Fix file tree, change action type

Fix file tree, change action type, change wrong param

Fix file tree, change action type, change wrong param, typo

Add final details

Change dir

Change dir, fix missing clone command

Include logging

Update OHRI Docs user

Change the hidden folder

Change to copy contents

Change the recursive copy

Update to zip due to errors

* updates deploy branch to main

---------

Co-authored-by: LarsLemos <[email protected]>
  • Loading branch information
pirupius and larslemos authored Jan 10, 2024
1 parent 216ea15 commit a7ac46d
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 10 deletions.
42 changes: 42 additions & 0 deletions .github/deploy_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env sh

# Rename the directory with suffix _backup_current_timestamp

if [ -d "ohri-docs" ]; then
cd ..
mv ohri-docs ohri-docs_backup_$(date +%Y%m%d_%H%M%S)
echo "--- OHRI Backup successful ---"
else
echo "--- ohri-docs folder not found, backup not performed ---"
fi

# Clone the repository
git clone https://github.com/UCSF-IGHS/ohri-docs.git

# Navigate into the cloned directory
echo "--- Navigate into the cloned directory ---"
chown -R
cd ohri-docs
ls -la -t

# Install dependencies and build the code
echo "--- Installing dependencies and building the code ---"
npx yarn install
npx yarn build

ls -la -t

# Copy the built code to the specified path on the server using scp
# scp -r ./build user@server:/usr/share/tomcat/microfrontends/ohri-docs
# scp -P 3220 -r .next [email protected]:/usr/share/tomcat/microfrontends/ohri_docs

echo "--- Copy Hidden folder .next to build folder to allow transfer to another server ---"
zip -r next_deploy.zip .next/
cp -R .next/* build

ls -la -t

scp -P 3220 -r build [email protected]:/usr/share/tomcat/microfrontends/ohri_docs
scp -P 3220 -r next_deploy.zip [email protected]:/usr/share/tomcat/microfrontends/ohri_docs

# scp -P 3220 -i /usr/local/ohridocs/.ssh/id_rsa -r .next [email protected]:/usr/share/tomcat/microfrontends/ohri_docs
39 changes: 31 additions & 8 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,44 @@ jobs:
- name: Run build
run: pnpm build

docs_deployment:
update_config:
runs-on: ubuntu-latest

needs: build
if: ${{ github.ref == 'refs/heads/main' }}

if: ${{ github.ref == 'refs/heads/dev' }}
steps:
- name: Checkout repo to make config folder local
uses: actions/checkout@v3
with:
ref: main
- run: ls -la .github/

- name: Copy Branch main Import Map to remote
uses: appleboy/[email protected]
with:
source: .github/deploy_docs.sh
target: /usr/share/tomcat/microfrontends/ohri-docs
host: ${{ secrets.HISTAC_HOST }}
username: ${{ secrets.HISTAC_USERNAME }}
key: ${{ secrets.HISTAC_OHRI_KEY}}
port: ${{ secrets.HISTAC_PORT }}

docs_deployment:
runs-on: ubuntu-latest
needs: update_config
if: ${{ github.ref == 'refs/heads/main' }}

steps:
# Update the Microfrontends to reflect what we have in the Working branch
# Update the Microfrontends to reflect what we have in the working branch
- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- uses: garygrossgarten/github-action-ssh@release
name: BackUp and Run the Update DOCS Site Script
with:
command: cd /usr/share/tomcat/microfrontends/
sh deploy-ohri-docs.sh
command: cd /usr/share/tomcat/microfrontends/ohri-docs/.github && sh deploy_docs.sh
host: ${{ secrets.HISTAC_HOST }}
username: ${{ secrets.HISTAC_USERNAME }}
privateKey: ${{ secrets.HISTAC_KEY}}
username: ${{ secrets.OHRI_DOCS_USER }}
# username: ${{ secrets.HISTAC_USERNAME }}
privateKey: ${{ secrets.OHRI_DOCS_USER_KEY}}
# privateKey: ${{ secrets.HISTAC_KEY}}
port: ${{ secrets.HISTAC_PORT }}
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

This documentation is intended to enable users to utilize the features of the React Form Engine (RFE) as well as OHRI associated packages.

Local Development
[**Live Demo →**](https://ohri-docs.globalhealthapp.net/)

## Local Development

To install the dependancies run:
```bash
Expand All @@ -11,7 +13,11 @@ pnpm install

To start the dev server on port 3000 run:
```bash
pnpm run dev
pnpm dev
```

The documentation website for the React Form Engne https://ohri-docs.globalhealthapp.net.

## License

MPL 2.0
3 changes: 3 additions & 0 deletions theme.config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ const themeConfig = {
project: {
link: "https://github.com/UCSF-IGHS/ohri-docs",
},
chat: {
link: "https://openmrs.slack.com/archives/C01PW9FSJBT",
},
footer: {
text: <span>© {new Date().getFullYear()} UCSF</span>,
},
Expand Down

0 comments on commit a7ac46d

Please sign in to comment.