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

Github deployment in actions #68

Merged
merged 2 commits into from
Oct 5, 2022
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
17 changes: 10 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Deploy to github pages

on:
# only try to run when test actions have completed on main or deploy_github for testing
# only try to run when test actions have completed on main
workflow_run:
workflows: [ "Tests" ]
branches: [ main, deploy_github ]
branches: [ main ]
types:
- completed

Expand All @@ -25,8 +25,11 @@ jobs:
- name: Install dependencies
run: |
npm ci
- name: Setup mock git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "Unused account"
- run: npm run deploy
- run: npm run predeploy
Comment on lines -32 to +28
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we want to run predeploy directly here without the full npm run deploy operation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah because the deploy creates a local commit so we'd need to setup a github user within the action which is a massive pain. Instead we build it and then let the specific github action for deployment handle it

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
# disabling jekyll seems to stop environmental variables from being read by react
enable_jekyll: true
5 changes: 2 additions & 3 deletions src/components/fhir/FhirAuthoriser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { FC, useEffect, useState } from "react";
import { oauth2 as SMART } from "fhirclient";

import LoadingSpinner from "../UI/LoadingSpinner";
import ModalWrapper from "../UI/ModalWrapper";
import { ModalState } from "../UI/ModalWrapper";
import ModalWrapper, { ModalState } from "../UI/ModalWrapper";

const FHIR_URL = process.env.REACT_APP_FHIR_URL;
const CLIENT_ID = process.env.REACT_APP_CLIENT_ID;
Expand Down Expand Up @@ -32,7 +31,7 @@ const FhirAuthoriser: FC = () => {
.catch((error) => {
console.log(error);
setModal({
message: "Something went wrong connecting to the FHIR authoriser. Please try again later.",
message: "Something went wrong connecting to the FHIR server.",
isError: true,
});
})
Expand Down