Skip to content

Commit

Permalink
Merge branch 'develop' into more-workflow-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jtrouth authored Mar 6, 2024
2 parents fe4a936 + 4852b92 commit 1a297cc
Show file tree
Hide file tree
Showing 26 changed files with 338 additions and 109 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,20 @@ jobs:
name: Get deploy tag
id: deploy-tag
run: |
# Parse container image tag to deploy
full_tag=$(echo "$DOCKER_METADATA_OUTPUT_JSON" | jq -r '.tags[] | limit(1; select(. | test(":sha-|:v.")))')
echo "Will use tag \"$full_tag\" for deployment."
echo image_tag=$(echo "$full_tag" | cut -f2 -d:) >> "$GITHUB_OUTPUT"
echo image_name=$(echo "$full_tag" | cut -f1 -d:) >> "$GITHUB_OUTPUT"
echo full_tag=$full_tag >> "$GITHUB_OUTPUT"
# Determine environment to deploy to
if ${{ github.ref == 'master' || github.base_ref == 'master'}}; then
environment_name="int"
credentials_json='${{ secrets.SKYVIEWER_INT_SERVICE_ACCOUNT }}'
elif ${{ github.ref_type == 'tag'}}; then
environment_name="prod"
credentials_json='${{ secrets.PIPELINE_EPO_PROD_PROJECT }}'
else
environment_name="dev"
credentials_json='${{ secrets.DEV_SA_KEY }}'
fi
echo environment_name=$environment_name >> "$GITHUB_OUTPUT"
echo credentials_json=$credentials_json >> "$GITHUB_OUTPUT"
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dev-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
--build-arg NEXT_PUBLIC_DEBUG_LOGGING=false \
--build-arg CLOUD_ENV=DEV \
--build-arg NEXT_PUBLIC_GOOGLE_APP_ID=688095955960-t0fpaj4ec3gh5vsr9lhg8govapk2oeo9.apps.googleusercontent.com \
--build-arg GOOGLE_APP_SECRET=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 \
--build-arg NEXT_PUBLIC_CONTACT_FORM_POST_URL=https://api-dev.rubinobs.com/actions/contact-form/send \
--build-arg NEXT_PUBLIC_PLAUSIBLE_DOMAIN= \
--build-arg NEXT_PREVIEW_SLUG=preview-in-craft-cms \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dev-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
--build-arg CLOUD_ENV=DEV \
--build-arg NEXT_PUBLIC_BASE_URL=https://dev.rubinobs.com \
--build-arg NEXT_PUBLIC_GOOGLE_APP_ID=688095955960-t0fpaj4ec3gh5vsr9lhg8govapk2oeo9.apps.googleusercontent.com \
--build-arg GOOGLE_APP_SECRET=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 \
--build-arg NEXT_PUBLIC_CONTACT_FORM_POST_URL=https://api-dev.rubinobs.com/actions/contact-form/send \
--build-arg NEXT_PUBLIC_PLAUSIBLE_DOMAIN= \
--build-arg NEXT_PREVIEW_SLUG=preview-in-craft-cms \
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/master-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ jobs:
--build-arg NEXT_PUBLIC_DEBUG_LOGGING=false \
--build-arg CLOUD_ENV=INT \
--build-arg NEXT_PUBLIC_BASE_URL=https://int.rubinobs.dev \
--build-arg NEXT_PUBLIC_GOOGLE_APP_ID=688095955960-t0fpaj4ec3gh5vsr9lhg8govapk2oeo9.apps.googleusercontent.com \
--build-arg NEXT_PUBLIC_GOOGLE_APP_ID=422617727806-q7opitpsisom3fekpplsh8b77s0oe6n2.apps.googleusercontent.com \
--build-arg GOOGLE_APP_SECRET=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 \
--build-arg NEXT_PUBLIC_CONTACT_FORM_POST_URL=https://api-int.rubinobs.dev/actions/contact-form/send \
--build-arg NEXT_PUBLIC_PLAUSIBLE_DOMAIN= \
--build-arg NEXT_PREVIEW_SLUG=preview-in-craft-cms \
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/master-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
--build-arg EDC_LOGGER_API_URL=https://us-central1-skyviewer.cloudfunctions.net/edc-logger \
--build-arg NEXT_PUBLIC_DEBUG_LOGGING=false \
--build-arg CLOUD_ENV=INT \
--build-arg NEXT_PUBLIC_GOOGLE_APP_ID=688095955960-t0fpaj4ec3gh5vsr9lhg8govapk2oeo9.apps.googleusercontent.com \
--build-arg NEXT_PUBLIC_GOOGLE_APP_ID=422617727806-q7opitpsisom3fekpplsh8b77s0oe6n2.apps.googleusercontent.com \
--build-arg GOOGLE_APP_SECRET=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 \
--build-arg NEXT_PUBLIC_CONTACT_FORM_POST_URL=https://api-int.rubinobs.dev/actions/contact-form/send \
--build-arg NEXT_PUBLIC_PLAUSIBLE_DOMAIN= \
--build-arg NEXT_PREVIEW_SLUG=preview-in-craft-cms \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/prod-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
--build-arg NEXT_PUBLIC_DEBUG_LOGGING=false \
--build-arg CLOUD_ENV=PROD \
--build-arg NEXT_PUBLIC_GOOGLE_APP_ID=596747551410-vcqlrp7erg5c5gm0dkvc0k21mgi0ilg0.apps.googleusercontent.com \
--build-arg GOOGLE_APP_SECRET=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 \
--build-arg NEXT_PUBLIC_CONTACT_FORM_POST_URL=https://api.rubinobs.org/actions/contact-form/send \
--build-arg NEXT_PUBLIC_PLAUSIBLE_DOMAIN=rubinobservatory.org,all.epo.sites \
--build-arg NEXT_PREVIEW_SLUG=preview-in-craft-cms \
Expand Down
52 changes: 52 additions & 0 deletions components/atomic/Button/patterns/GoogleSSOButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import PropTypes from "prop-types";
import { useGoogleLogin } from "@react-oauth/google";
import { useRouter } from "next/router";
import { useAuthenticationContext } from "@/contexts/Authentication";
import SSOButton from "./SSOButton";

export default function GoogleSSOButton({ children, ...buttonProps }) {
const { authenticateWithGoogle } = useAuthenticationContext();
const { query, push, asPath, pathname } = useRouter();
const goToGoogleSignIn = useGoogleLogin({
state: asPath,
onSuccess: (response) => {
push(
{ pathname: asPath.split("?")[0], query: { sso: true } },
undefined,
{
shallow: true,
}
);
fetch("/api/authGoogle", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ code: response.code }),
})
.then((res) => res.json())
.then((data) => {
authenticateWithGoogle(data);
})
.catch(console.error);
},
onError: (error) => {
console.error(error);
},
flow: "auth-code",
});

return (
<SSOButton
{...buttonProps}
service="google"
type="button"
onClick={goToGoogleSignIn}
>
{children}
</SSOButton>
);
}

GoogleSSOButton.propTypes = {
children: PropTypes.node,
service: PropTypes.oneOf(["google", "facebook", "email"]),
};
1 change: 1 addition & 0 deletions components/atomic/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { default as SSOButton } from "./Button/patterns/SSOButton";
export { default as GoogleSSOButton } from "./Button/patterns/GoogleSSOButton";
export { default as EarlyAccess } from "./Flag/patterns/EarlyAccess";
export { default as Tile } from "./Tile";
export { default as InvestigationTile } from "./Tile/patterns/InvestigationTile";
Expand Down
3 changes: 2 additions & 1 deletion components/auth/AuthorizePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const AUTHORIZED_TYPES = {
};

function isAuthorized(typeHandle, user, status) {
if (typeHandle === "educatorPages") return user?.group === "educators";
if (typeHandle === "educatorPages")
return user?.group === "educators" && status === "active";
if (typeHandle === "userProfilePage") return !!user && status === "active";
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion components/dynamic/EventList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const EventList = ({
endDate,
description,
id,
hero,
image,
eventType,
registrationCloseDate,
Expand Down Expand Up @@ -82,7 +83,7 @@ const EventList = ({
}
: null
}
image={image?.[0]}
image={image?.[0] || hero?.[0]}
link={uri}
pretitle={
gridType === "events" && eventType?.[0]?.title
Expand Down
3 changes: 2 additions & 1 deletion components/dynamic/JobList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ const JobList = ({
);

// logic for open/closed
const checkOpen = checkIfBetweenDates(openDate, closeDate)
let checkOpen = "open";
checkOpen = checkIfBetweenDates(openDate, closeDate)
? "open"
: "closed";
const lock = checkOpen === "open" ? "LockOpen" : "LockClosed";
Expand Down
7 changes: 6 additions & 1 deletion components/dynamic/NewsList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const NewsList = ({
description,
subtitle,
id,
hero,
image,
images: releaseImages,
newsAssets,
Expand All @@ -70,7 +71,11 @@ const NewsList = ({
}
: null
}
image={image?.[0] || makeReleaseFeature(releaseImages)?.[0]}
image={
image?.[0] ||
makeReleaseFeature(releaseImages)?.[0] ||
hero?.[0]
}
isFeature={canShowFeatured && page === 1 && i === 0}
link={uri}
pretitle={
Expand Down
24 changes: 13 additions & 11 deletions components/dynamic/RelatedList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@ const RelatedList = ({
<>
{entries?.length > 0 && (
<Grid columns={cols}>
{entries.map(({ id, description, image, title, uri }, i) => (
<Tile
key={id}
image={image?.[0]}
link={uri}
text={striptags(description)}
title={title}
titleTag={"h2"}
type={gridType}
/>
))}
{entries.map(
({ id, description, hero, image, title, uri }, i) => (
<Tile
key={id}
image={image?.[0] || hero?.[0]}
link={uri}
text={striptags(description)}
title={title}
titleTag={"h2"}
type={gridType}
/>
)
)}
</Grid>
)}
</>
Expand Down
8 changes: 4 additions & 4 deletions components/modal/RegisterModal/JoinForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
import Link from "next/link";
import { Link as BaseLink } from "@rubin-epo/epo-react-lib";
import { SSOButton } from "@/components/atomic";
import { GoogleSSOButton, SSOButton } from "@/components/atomic";
import useAuthModal from "@/hooks/useAuthModal";
import { useAuthenticationContext } from "@/contexts/Authentication";
import AuthModal from "../../AuthModal";
Expand All @@ -14,7 +14,7 @@ export default function JoinForm({ onEmailSignup }) {
const {
pendingGroup,
setPendingGroup,
goToGoogleSignIn,
// goToGoogleSignIn,
goToFacebookSignIn,
} = useAuthenticationContext();

Expand Down Expand Up @@ -47,9 +47,9 @@ export default function JoinForm({ onEmailSignup }) {
</AuthModal.Description> */}
</div>
<Styled.SSOButtons>
<SSOButton service="google" type="button" onClick={goToGoogleSignIn}>
<GoogleSSOButton service="google" type="button">
{t("join.continue_with_google")}
</SSOButton>
</GoogleSSOButton>
{/* <SSOButton
service="facebook"
type="button"
Expand Down
8 changes: 4 additions & 4 deletions components/modal/SignInModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Link from "next/link";
import { useForm } from "react-hook-form";
import { useAuthenticationContext } from "@/contexts/Authentication";
import useAuthModal from "@/hooks/useAuthModal";
import { SSOButton } from "@/components/atomic";
import { GoogleSSOButton } from "@/components/atomic";
import {
Link as BaseLink,
Button,
Expand Down Expand Up @@ -118,9 +118,9 @@ export default function SignInModal() {
</Button>
</Styled.SignInAsButtons> */}
<Styled.SSOButtons>
<SSOButton service="google" onClick={goToGoogleSignIn}>
{t("sign_in.continue_with_google")}
</SSOButton>
<GoogleSSOButton service="google" type="button">
{t("join.continue_with_google")}
</GoogleSSOButton>
{/* <SSOButton service="facebook" onClick={goToFacebookSignIn}>
{t("sign_in.continue_with_facebook")}
</SSOButton> */}
Expand Down
13 changes: 8 additions & 5 deletions components/templates/NewsPage/MediaAssets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from "prop-types";
import Link from "next/link";
import { useTranslation } from "react-i18next";
import { ResponsiveImage } from "@rubin-epo/epo-react-lib";
import { ResponsiveImage, Figure } from "@rubin-epo/epo-react-lib";
import ReleaseAssets from "./ReleaseAssets";
import * as Styled from "./styles";

Expand All @@ -15,19 +15,22 @@ export default function MediaAssets({
if (!contentBlockAssets && !releaseImages && !releaseVideos) return null;

if (
contentBlockAssets?.length <= 0 &&
releaseImages?.length <= 0 &&
releaseVideos?.length <= 0
contentBlockAssets?.length === 0 &&
releaseImages?.length === 0 &&
releaseVideos?.length === 0
)
return null;

return (
<Styled.AsideSecondary>
<h3>{t(`media`)}</h3>
{contentBlockAssets.map((asset, i) => {
if (asset.image?.[0].url) {
return (
<Link key={i} prefetch={false} href={asset.image?.[0].url}>
<ResponsiveImage image={asset.image?.[0]} ratio="8:5" />
<Figure caption={asset.caption}>
<ResponsiveImage image={asset.image?.[0]} ratio="8:5" />
</Figure>
</Link>
);
}
Expand Down
28 changes: 15 additions & 13 deletions components/templates/NewsPage/NewsAside.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
import PropTypes from "prop-types";
import Link from "next/link";
import { ResponsiveImage, IconComposer } from "@rubin-epo/epo-react-lib";
import {
ResponsiveImage,
IconComposer,
Figure,
} from "@rubin-epo/epo-react-lib";
import Tags from "./Tags";
import MediaAssets from "./MediaAssets";
import * as Styled from "./styles";

export default function NewsAside({
newsAssets,
manualAssets,
contentBlockAssets,
releaseImages,
releaseVideos,
tags,
rootHomeLink,
}) {
// This sets up the automatic media grabber -- if there are no manual media set
let manualMedia = false;
// This adds the document icon from the designs, if there is a text-style link near the start.
let manualDoc = newsAssets.some(
let manualDoc = manualAssets.some(
(a, i) => i < 4 && (a.textLink?.length > 0 || a.externalLink?.length > 0)
);

return (
<Styled.Aside>
{newsAssets?.length > 0 && (
{manualAssets?.length > 0 && (
<Styled.AsidePrimary>
{newsAssets.map((a, i) => {
{manualAssets.map((a, i) => {
if (a.assetHeader) {
return (
<h3 key={i}>
Expand Down Expand Up @@ -53,14 +55,14 @@ export default function NewsAside({
</a>
);
} else if (a.image?.length > 0) {
manualMedia = true;
return (
<a href={a.image[0].url} key={i}>
<ResponsiveImage image={a.image[0]} />
</a>
<Link key={i} prefetch={false} href={a.image[0].url}>
<Figure caption={a.caption}>
<ResponsiveImage image={a.image[0]} ratio="8:5" />
</Figure>
</Link>
);
} else if (a.galleryItem?.length > 0) {
manualMedia = true;
if (a.galleryItem[0].uri) {
return (
<Link
Expand Down Expand Up @@ -89,7 +91,7 @@ export default function NewsAside({
}

NewsAside.propTypes = {
newsAssets: PropTypes.array,
manualAssets: PropTypes.array,
contentBlockAssets: PropTypes.array,
releaseImages: PropTypes.array,
releaseVideos: PropTypes.array,
Expand Down
Loading

0 comments on commit 1a297cc

Please sign in to comment.