Skip to content

Commit

Permalink
merging dev
Browse files Browse the repository at this point in the history
  • Loading branch information
katiestahl committed Oct 9, 2023
2 parents 6e3d685 + 8d67689 commit 2499ef7
Show file tree
Hide file tree
Showing 61 changed files with 977 additions and 564 deletions.
26 changes: 26 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
changelog:
exclude:
labels:
- test
authors:
- dependabot
- github-actions
categories:
- title: New Features
labels:
- requirement
- epic
- title: Enhancements
labels:
- enhancement
- performance
- title: Bug Fixes
labels:
- bug
- title: Clean-up
labels:
- cleanup
- technical debt
- title: Other Changes
labels:
- "*"
44 changes: 44 additions & 0 deletions .github/workflows/build_client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build DGIdb React Frontend

on:
workflow_call:
inputs:
branch:
required: true
type: string

jobs:
build_frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- run: npm install -g yarn
working-directory: ./client

- run: yarn install
working-directory: ./client

- run: rm -rf public/*
working-directory: ./server

- run: CI=false yarn build:${{ inputs.branch == 'main' && 'prod' || inputs.branch }}
working-directory: ./client

- run: cp -r ../../client/build/* .
working-directory: ./server/public

- name: Commit and push build
uses: EndBug/add-and-commit@v9
with:
add: server/public/*
push: origin ${{ inputs.branch }}
message: Automated frontend build
48 changes: 48 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy DGIdb

on:
workflow_call:
inputs:
environment:
required: true
type: string
secrets:
SSH_HOST:
required: true
SSH_KEY:
required: true

jobs:
deploy:
name: Capistrano Deploy to Server
runs-on: ubuntu-latest
steps:
- name: Install SSH key to Server
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
name: github-actions
known_hosts: 'random-placeholder-value-replaced-by-keyscan-below'
if_key_exists: replace
config: |
host ${{ secrets.SSH_HOST }}
IdentityFile ~/.ssh/github-actions
IdentitiesOnly yes
ForwardAgent yes
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }}

- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: ./server
ruby-version: '3.1'
bundler-cache: true

- name: Deploy
working-directory: ./server
run: |
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/github-actions
bundle exec cap ${{ inputs.environment }} deploy
54 changes: 0 additions & 54 deletions .github/workflows/deploy_client.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build and deploy production

on:
release:
types: [published]
jobs:
build-production:
uses: dgidb/dgidb-v5/.github/workflows/build_client.yml@main
with:
branch: main
deploy-production:
uses: dgidb/dgidb-v5/.github/workflows/deploy.yml@main
needs: build-production
with:
environment: production
secrets:
SSH_HOST: ${{ secrets.DGIDB_PRODUCTION_SSH_HOST }}
SSH_KEY: ${{ secrets.DGIDB_PRODUCTION_SSH_KEY }}

19 changes: 19 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build and deploy staging

on:
push:
branches: [staging]
jobs:
build-staging:
uses: dgidb/dgidb-v5/.github/workflows/build_client.yml@main
with:
branch: staging
deploy-staging:
uses: dgidb/dgidb-v5/.github/workflows/deploy.yml@main
needs: build-staging
with:
environment: staging
secrets:
SSH_HOST: ${{ secrets.DGIDB_STAGING_SSH_HOST }}
SSH_KEY: ${{ secrets.DGIDB_STAGING_SSH_KEY }}

4 changes: 2 additions & 2 deletions client/.env.prod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
REACT_APP_API_URI="http://dgidb-prod.us-east-2.elasticbeanstalk.com/api/graphql"
REACT_APP_API_URI="https://beta.dgidb.org/api/graphql"

PORT=3001
PORT=443
4 changes: 2 additions & 2 deletions client/.env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
REACT_APP_API_URI="http://dgidb-prod.us-east-2.elasticbeanstalk.com/api/graphql"
REACT_APP_API_URI="https://beta.dgidb.org/api/graphql"

PORT=3001
PORT=443
2 changes: 0 additions & 2 deletions client/src/components/Layout/MainLayout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ header {

footer {
background-color: var(--theme-primary);
position: fixed;
bottom: 0;
color: white;
margin-top: auto;
width: 100%;
Expand Down
38 changes: 22 additions & 16 deletions client/src/components/Layout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { GlobalClientContext } from 'stores/Global/GlobalClient';
import './MainLayout.scss';
import { Box, Button, IconButton, Menu, MenuItem } from '@mui/material';
import HighlightOffIcon from '@mui/icons-material/HighlightOff';
import ReleaseInformation from 'components/Shared/ReleaseInformation/ReleaseInformation';

type MainLayoutProps = {
children: React.ReactNode;
Expand Down Expand Up @@ -80,24 +81,29 @@ const Header: React.FC = () => {
};

const Footer: React.FC = () => {
const { dispatch } = useContext(GlobalClientContext);
const { state, dispatch } = useContext(GlobalClientContext);

return (
<footer>
Disclaimer: This resource is intended for purely research purposes. It
should not be used for emergencies or medical or professional advice.
<IconButton
style={{
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
marginLeft: '10px',
fontSize: '25px',
}}
onClick={() => dispatch({ type: ActionTypes.HideDisclaimer })}
>
<HighlightOffIcon />
</IconButton>
{state.themeSettings.showDisclaimer && (
<div>
Disclaimer: This resource is intended for purely research purposes. It
should not be used for emergencies or medical or professional advice.
<IconButton
style={{
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
marginLeft: '10px',
fontSize: '25px',
}}
onClick={() => dispatch({ type: ActionTypes.HideDisclaimer })}
>
<HighlightOffIcon />
</IconButton>
</div>
)}
<ReleaseInformation />
</footer>
);
};
Expand Down Expand Up @@ -127,7 +133,7 @@ export const MainLayout = ({ children }: MainLayoutProps) => {
<div className="content-container">
<Box className="content">{children}</Box>
</div>
{state.themeSettings.showDisclaimer && <Footer />}
<Footer />
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.release-info {
font-size: 16px;

a {
color: white;
text-decoration: underline;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import './ReleaseInformation.scss';
import React, { useState, useEffect } from 'react';

const ReleaseInformation: React.FC = () => {
interface GithubRelease {
html_url: string;
name: string;
published_at: string;
}

const [currentRelease, setCurrentRelease] = useState<
GithubRelease | undefined
>(undefined);

const fetchRelease = async () => {
const response = await fetch(
'https://api.github.com/repos/dgidb/dgidb-v5/releases?per_page=1'
);
if (response.ok) {
const body = await response.json();
setCurrentRelease(body[0]);
} else {
setCurrentRelease(undefined);
}
};

useEffect(() => {
fetchRelease();
}, []);

return (
<div>
{currentRelease && (
<div className="release-info">
DGIdb {currentRelease.name} (
{new Date(currentRelease.published_at).toLocaleString().split(',')[0]}
)&nbsp; &bull; &nbsp;
<a href={currentRelease.html_url} target="_blank">
Release Notes
</a>
&nbsp; &bull; &nbsp;
<a href="https://github.com/dgidb/dgidb-v5/releases/" target="_blank">
History
</a>
</div>
)}
</div>
);
};

export default ReleaseInformation;
1 change: 1 addition & 0 deletions client/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
--header-gradient-2: #180a20;
--logo-gradient-1: #f7f7f8;
--logo-gradient-2: #ada7bd;
--link: #2589bd;
}

[data-theme='light-home'] {
Expand Down
Loading

0 comments on commit 2499ef7

Please sign in to comment.