Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync dev to main #12

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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