Merge pull request #67 from PiusKariuki/chore/procedures-specify-fiel… #99
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: eHospital CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
release: | |
types: | |
- created | |
env: | |
TURBO_API: 'http://127.0.0.1:9080' | |
TURBO_TOKEN: ${{ secrets.TURBO_SERVER_TOKEN }} | |
TURBO_TEAM: ${{ github.repository_owner }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install | |
- name: Setup local cache server for Turborepo | |
uses: felixmosh/turborepo-gh-artifacts@v1 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
server-token: ${{ secrets.TURBO_SERVER_TOKEN }} | |
- name: Run build | |
run: yarn turbo run build --color --concurrency=5 | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: packages | |
path: | | |
packages/**/dist | |
deploy_esm_billing_app: | |
runs-on: ubuntu-latest | |
env: | |
DIR_NAME: "esm-billing-app" | |
ESM_NAME: "@ssemr/esm-patient-hiv-art-app" | |
JS_NAME: "ssemr-esm-patient-hiv-art-app.js" | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v2 | |
- name: Compute Timestamp | |
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Prepare Directory | |
shell: bash | |
run: | | |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }} | |
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
deploy_esm_patient_registration_app: | |
runs-on: ubuntu-latest | |
env: | |
DIR_NAME: "esm-patient-registration-app" | |
ESM_NAME: "@sjthc/esm-billing-app" | |
JS_NAME: "sjthc-esm-billing-app.js" | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v2 | |
- name: Compute Timestamp | |
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Prepare Directory | |
shell: bash | |
run: | | |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }} | |
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
deploy_esm_patient_list_app: | |
runs-on: ubuntu-latest | |
env: | |
DIR_NAME: "esm-patient-list-app" | |
ESM_NAME: "@sjthc/esm-patient-list-app" | |
JS_NAME: "sjthc-esm-patient-list-app.js" | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v2 | |
- name: Compute Timestamp | |
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Prepare Directory | |
shell: bash | |
run: | | |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }} | |
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
deploy_esm_patient_registartion_app: | |
runs-on: ubuntu-latest | |
env: | |
DIR_NAME: "esm-patient-registration-app" | |
ESM_NAME: "@sjthc/esm-patient-registration-app" | |
JS_NAME: "sjthc-esm-patient-registration-app.js" | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v2 | |
- name: Compute Timestamp | |
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Prepare Directory | |
shell: bash | |
run: | | |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }} | |
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
deploy_esm_reports_app: | |
runs-on: ubuntu-latest | |
env: | |
DIR_NAME: "esm-reports-app" | |
ESM_NAME: "@sjthc/esm-reports-app" | |
JS_NAME: "sjthc-esm-reports-app.js" | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v2 | |
- name: Compute Timestamp | |
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Prepare Directory | |
shell: bash | |
run: | | |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }} | |
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
deploy_esm_service_queues_app: | |
runs-on: ubuntu-latest | |
env: | |
DIR_NAME: "esm-service-queues-app" | |
ESM_NAME: "@sjthc/esm-service-queues-app" | |
JS_NAME: "sjthc-esm-service-queues-app.js" | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v2 | |
- name: Compute Timestamp | |
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Prepare Directory | |
shell: bash | |
run: | | |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }} | |
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/ | |
pre_release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
registry-url: "https://registry.npmjs.org" | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npx lerna bootstrap | |
- name: Build | |
run: yarn turbo run build --color | |
- name: Patch | |
run: yarn lerna version patch --no-git-tag-version --no-push --yes | |
- name: Version | |
run: npx lerna version "$(node -e "console.log(require('./lerna.json').version)")-pre.${{ github.run_number }}" --no-git-tag-version --yes | |
- run: git config user.email "[email protected]" && git config user.name "eHospital CI" | |
- run: git add . && git commit -m "Prerelease version" --no-verify | |
- name: Pre-release | |
run: yarn run ci:prepublish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: see directory | |
shell: bash | |
run: | | |
ls -alh | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ github.event_name == 'release' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org' | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --immutable | |
- name: Setup local cache server for Turborepo | |
uses: felixmosh/turborepo-gh-artifacts@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
server-token: ${{ env.TURBO_TOKEN }} | |
- name: Build | |
run: yarn turbo run build --color --concurrency=5 | |
- name: Publish | |
run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn run ci:publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |