diff --git a/.github/deploy_docs.sh b/.github/deploy_docs.sh new file mode 100644 index 0000000..3ea6cac --- /dev/null +++ b/.github/deploy_docs.sh @@ -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 ohridocs@reports.globalhealthapp.net:/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 ohridocs@reports.globalhealthapp.net:/usr/share/tomcat/microfrontends/ohri_docs +scp -P 3220 -r next_deploy.zip ohridocs@reports.globalhealthapp.net:/usr/share/tomcat/microfrontends/ohri_docs + +# scp -P 3220 -i /usr/local/ohridocs/.ssh/id_rsa -r .next ohridocs@reports.globalhealthapp.net:/usr/share/tomcat/microfrontends/ohri_docs diff --git a/.github/workflows/docs-ci.yml b/.github/workflows/docs-ci.yml index 364adbc..ab6c0e2 100644 --- a/.github/workflows/docs-ci.yml +++ b/.github/workflows/docs-ci.yml @@ -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/scp-action@v0.1.4 + 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 }} diff --git a/README.md b/README.md index 5a71b2b..897a2b3 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/theme.config.jsx b/theme.config.jsx index 13f137e..ed1987e 100644 --- a/theme.config.jsx +++ b/theme.config.jsx @@ -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: © {new Date().getFullYear()} UCSF, },