From 536d609a29b0deea41a6e1fee70b5bebdf08c068 Mon Sep 17 00:00:00 2001 From: Remko Date: Wed, 28 Feb 2024 11:02:20 +0100 Subject: [PATCH] Added page deploy workflow --- .env | 3 ++ .env.development | 3 ++ .env.production | 3 ++ .../huwelijksplanner-page-deploy.yml | 52 +++++++++++++++++++ pages/_app.tsx | 7 +-- pages/_document.tsx | 2 +- pages/email-reservation-success.tsx | 16 ++---- pages/huwelijksplanner-cancel.tsx | 7 ++- pages/persoonsgegevens/[person].tsx | 9 ++-- pages/sitemap.tsx | 3 +- .../voorgenomen-huwelijk/getuigen/succes.tsx | 3 +- .../partner/aanvrager-email.tsx | 16 ++---- .../partner/invitation-email-partner.tsx | 16 ++---- .../huwelijksplanner/PageFooterTemplate.tsx | 8 +-- .../huwelijksplanner/PageHeaderTemplate.tsx | 12 +---- styles/utrecht-theme.css | 3 ++ 16 files changed, 96 insertions(+), 67 deletions(-) create mode 100644 .env.development create mode 100644 .env.production create mode 100644 .github/workflows/huwelijksplanner-page-deploy.yml diff --git a/.env b/.env index db3a6274..4f2844b2 100644 --- a/.env +++ b/.env @@ -9,3 +9,6 @@ VERSION= NEXT_PUBLIC_API_URL=https://api.huwelijksplanner.online/api NEXT_PUBLIC_MATOMO_URL=https://stats.utrecht.nl/analytics/ NEXT_PUBLIC_MATOMO_SITE_ID=5 +NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME=utrecht-theme +NEXT_PUBLIC_ORGANISATION_NAME=Gemeente Utrecht +NEXT_PUBLIC_FAV_ICON=https://www.utrecht.nl/favicon.ico diff --git a/.env.development b/.env.development new file mode 100644 index 00000000..005a2855 --- /dev/null +++ b/.env.development @@ -0,0 +1,3 @@ +NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME=leiden-theme +NEXT_PUBLIC_ORGANISATION_NAME=Gemeente Leiden +NEXT_PUBLIC_FAV_ICON=https://gemeente.leiden.nl/typo3conf/ext/leiden_template/Resources/Public/Images/favicon/favicon-96x96.png diff --git a/.env.production b/.env.production new file mode 100644 index 00000000..6bb850a8 --- /dev/null +++ b/.env.production @@ -0,0 +1,3 @@ +NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME= +NEXT_PUBLIC_ORGANISATION_NAME= +NEXT_PUBLIC_FAV_ICON= diff --git a/.github/workflows/huwelijksplanner-page-deploy.yml b/.github/workflows/huwelijksplanner-page-deploy.yml new file mode 100644 index 00000000..a6c50cc6 --- /dev/null +++ b/.github/workflows/huwelijksplanner-page-deploy.yml @@ -0,0 +1,52 @@ +name: Deploy the Huwelijksplanner Page to GitHub Pages + +env: # Change these to your preferences any image url can also be a base encoded image + GITHUB_PAGES_BRANCH: gh-pages + + NL_DESIGN_THEME_CLASSNAME: leiden-theme + ORGANISATION_NAME: Gemeente Leiden + FAV_ICON: https://gemeente.leiden.nl/typo3conf/ext/leiden_template/Resources/Public/Images/favicon/favicon-96x96.png + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Get the Huwelijksplanner Code + uses: actions/checkout@v2 + with: + repository: ConductionNL/utrecht-huwelijksplanner + ref: main + + # With special thanxs to https://github.com/SpicyPizza/create-envfile + - name: Make envfile + uses: SpicyPizza/create-envfile@v2.0 + with: + envkey_NEXT_PUBLIC_NL_DESIGN_THEME_CLASSNAME: ${{ env.NL_DESIGN_THEME_CLASSNAME }} + envkey_NEXT_PUBLIC_ORGANISATION_NAME: ${{ env.ORGANISATION_NAME }} + envkey_NEXT_PUBLIC_FAV_ICON: ${{ env.FAV_ICON }} + file_name: .env.production + fail_on_empty: true + sort_keys: false + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 + + - name: Install dependencies + run: npm install + + - name: Build application + run: npm run build + + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@4.1.0 + with: + branch: ${{ env.GITHUB_PAGES_BRANCH }} + folder: .next diff --git a/pages/_app.tsx b/pages/_app.tsx index 063c7791..9ea1017c 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -11,9 +11,6 @@ import { MarriageOptionsProvider } from "../src/context/MarriageOptionsContext"; import { matomo } from "../src/matomo"; const MyApp = ({ Component, pageProps }: AppProps) => { - const ClassName = "leiden-theme"; - const OrganisationName = ClassName === "leiden-theme" ? "Gemeente Leiden" : "Gemeente Utrecht"; - useEffect(() => { if (process.env.NEXT_PUBLIC_MATOMO_URL) { matomo({ @@ -21,12 +18,10 @@ const MyApp = ({ Component, pageProps }: AppProps) => { siteId: process.env.NEXT_PUBLIC_MATOMO_SITE_ID, }); } - window.sessionStorage.setItem("NL_DESIGN_THEME_CLASSNAME", ClassName); - window.sessionStorage.setItem("ORGANISATION_NAME", OrganisationName); }, []); return ( -
+
diff --git a/pages/_document.tsx b/pages/_document.tsx index 9c7ba639..0bdd9b33 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -8,7 +8,7 @@ export default function Document() { diff --git a/pages/email-reservation-success.tsx b/pages/email-reservation-success.tsx index 57a26c68..54c47c14 100644 --- a/pages/email-reservation-success.tsx +++ b/pages/email-reservation-success.tsx @@ -13,7 +13,6 @@ import { PageContentMain, Paragraph, URLValue, - UtrechtLogo, Logo, } from "../src/components"; @@ -70,7 +69,7 @@ export default function HuwelijksplannerStep0() { Met vriendelijke groet,
- {typeof window !== "undefined" && window.sessionStorage.getItem("ORGANISATION_NAME")} + {process.env.NEXT_PUBLIC_ORGANISATION_NAME}
Publiekszaken
@@ -78,15 +77,10 @@ export default function HuwelijksplannerStep0() {
Stadsplateau 1, 3521 AZ Utrecht
- {window.sessionStorage.getItem("NL_DESIGN_THEME_CLASSNAME") === "utrecht-theme" ? ( - - - - ) : ( - - - - )} + + + + diff --git a/pages/huwelijksplanner-cancel.tsx b/pages/huwelijksplanner-cancel.tsx index 696ceba5..201b53ed 100644 --- a/pages/huwelijksplanner-cancel.tsx +++ b/pages/huwelijksplanner-cancel.tsx @@ -32,8 +32,7 @@ export default function MultistepForm1() { if (!data.cancelable) { return ( - Huwelijk kan niet on-line geannuleerd worden. Neem contact op met{" "} - {typeof window !== "undefined" && window.sessionStorage.getItem("ORGANISATION_NAME")}. + Huwelijk kan niet on-line geannuleerd worden. Neem contact op met {process.env.NEXT_PUBLIC_ORGANISATION_NAME}. ); } @@ -52,8 +51,8 @@ export default function MultistepForm1() {
{t("huwelijksplanner-cancel:heading-1")} - De {typeof window !== "undefined" && window.sessionStorage.getItem("ORGANISATION_NAME")} brengt geen - kosten in rekening: je krijgt het volledige bedrag voor de reservering teruggestort op je rekening. + De {process.env.NEXT_PUBLIC_ORGANISATION_NAME} brengt geen kosten in rekening: je krijgt het volledige + bedrag voor de reservering teruggestort op je rekening. Weet je zeker dat je het voorgenomen huwelijk wil annuleren? diff --git a/pages/persoonsgegevens/[person].tsx b/pages/persoonsgegevens/[person].tsx index dbe29e18..cb929c5a 100644 --- a/pages/persoonsgegevens/[person].tsx +++ b/pages/persoonsgegevens/[person].tsx @@ -261,8 +261,11 @@ export default function MultistepForm1() { {...register("email", { required: true })} /> - +