diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..ffc345e --- /dev/null +++ b/.env.example @@ -0,0 +1,4 @@ +DOMIAN= +EN_AU_DOMAIN= +ES_MX_DOMAIN= +ROBOTS= \ No newline at end of file diff --git a/.github/workflows/development-build-and-deployment.yml b/.github/workflows/development-build-and-deployment.yml new file mode 100644 index 0000000..01b4eaf --- /dev/null +++ b/.github/workflows/development-build-and-deployment.yml @@ -0,0 +1,98 @@ +name: Development - Build and Deployment + +on: + workflow_dispatch: + push: + branches: + - development +permissions: + id-token: write + contents: read + +jobs: + website-build: + name: Website build + runs-on: ubuntu-latest + steps: + - name: Checking out branch + uses: actions/checkout@v5 + - name: Restoring cache + id: cache-npm + uses: actions/cache@v4 + with: + path: | + ~/.npm + .next/cache + node_modules + key: ${{runner.os}}-${{hashFiles('**/package-lock.json')}} + restore-keys: ${{runner.os}}- + - name: Installing dependencies + run: npm install + - name: Building website + run: npm run build + env: + DOMAIN: ${{vars.DEV_DOMAIN}} + EN_AU_DOMAIN: ${{vars.DEV_EN_AU_DOMAIN}} + ES_MX_DOMAIN: ${{vars.DEV_ES_MX_DOMAIN}} + ROBOTS: ${{vars.DEV_ROBOTS}} + - name: Preparing EN-AU artifacts + run: | + mkdir ${{github.workspace}}/en-au-artifacts + cp -r out/_next ${{github.workspace}}/en-au-artifacts + cp -r out/assets ${{github.workspace}}/en-au-artifacts + cp out/en-AU/*.html ${{github.workspace}}/en-au-artifacts + cp out/en-AU/*.txt ${{github.workspace}}/en-au-artifacts + cp out/robots.txt ${{github.workspace}}/en-au-artifacts + cp out/sitemap.xml ${{github.workspace}}/en-au-artifacts + - name: Uploading EN-AU artifacts + uses: actions/upload-artifact@v4 + with: + name: development-en-au + path: ${{github.workspace}}/en-au-artifacts + if-no-files-found: error + retention-days: 1 + compression-level: 9 + overwrite: true + include-hidden-files: true + - name: Preparing ES-MX artifacts + run: | + mkdir ${{github.workspace}}/es-mx-artifacts + cp -r out/_next ${{github.workspace}}/es-mx-artifacts + cp -r out/assets ${{github.workspace}}/es-mx-artifacts + cp out/es-MX/*.html ${{github.workspace}}/es-mx-artifacts + cp out/es-MX/*.txt ${{github.workspace}}/es-mx-artifacts + cp out/robots.txt ${{github.workspace}}/es-mx-artifacts + cp out/sitemap.xml ${{github.workspace}}/es-mx-artifacts + - name: Uploading ES-MX artifacts + uses: actions/upload-artifact@v4 + with: + name: development-es-mx + path: ${{github.workspace}}/es-mx-artifacts + if-no-files-found: error + retention-days: 1 + compression-level: 9 + overwrite: true + include-hidden-files: true + s3-deployment: + name: Deployment to S3 + runs-on: ubuntu-latest + needs: website-build + steps: + - name: Configuring AWS credentials + uses: aws-actions/configure-aws-credentials@v4.3.1 + with: + aws-region: ${{secrets.DEV_AWS_REGION}} + role-to-assume: ${{secrets.DEV_AWS_ROLE_ARN}} + role-session-name: FisoCodesDevelopmentDeployment + - name: Downloading EN-AU artifacts + uses: actions/download-artifact@v4 + with: + name: development-en-au + - name: Syncing EN-AU files to S3 + run: aws s3 sync ./ s3://${{secrets.DEV_EN_AU_S3_BUCKET_NAME}} --delete + - name: Downloading ES-MX artifacts + uses: actions/download-artifact@v4 + with: + name: development-es-mx + - name: Syncing ES-MX files to S3 + run: aws s3 sync ./ s3://${{secrets.DEV_ES_MX_S3_BUCKET_NAME}} --delete \ No newline at end of file diff --git a/.github/workflows/production-build-and-deployment.yml b/.github/workflows/production-build-and-deployment.yml new file mode 100644 index 0000000..73fa5b2 --- /dev/null +++ b/.github/workflows/production-build-and-deployment.yml @@ -0,0 +1,98 @@ +name: Production - Build and Deployment + +on: + workflow_dispatch: + push: + branches: + - main +permissions: + id-token: write + contents: read + +jobs: + website-build: + name: Website build + runs-on: ubuntu-latest + steps: + - name: Checking out branch + uses: actions/checkout@v5 + - name: Restoring cache + id: cache-npm + uses: actions/cache@v4 + with: + path: | + ~/.npm + .next/cache + node_modules + key: ${{runner.os}}-${{hashFiles('**/package-lock.json')}} + restore-keys: ${{runner.os}}- + - name: Installing dependencies + run: npm install + - name: Building website + run: npm run build + env: + DOMAIN: ${{vars.DOMAIN}} + EN_AU_DOMAIN: ${{vars.EN_AU_DOMAIN}} + ES_MX_DOMAIN: ${{vars.ES_MX_DOMAIN}} + ROBOTS: ${{vars.ROBOTS}} + - name: Preparing EN-AU artifacts + run: | + mkdir ${{github.workspace}}/en-au-artifacts + cp -r out/_next ${{github.workspace}}/en-au-artifacts + cp -r out/assets ${{github.workspace}}/en-au-artifacts + cp out/en-AU/*.html ${{github.workspace}}/en-au-artifacts + cp out/en-AU/*.txt ${{github.workspace}}/en-au-artifacts + cp out/robots.txt ${{github.workspace}}/en-au-artifacts + cp out/sitemap.xml ${{github.workspace}}/en-au-artifacts + - name: Uploading EN-AU artifacts + uses: actions/upload-artifact@v4 + with: + name: production-en-au + path: ${{github.workspace}}/en-au-artifacts + if-no-files-found: error + retention-days: 1 + compression-level: 9 + overwrite: true + include-hidden-files: true + - name: Preparing ES-MX artifacts + run: | + mkdir ${{github.workspace}}/es-mx-artifacts + cp -r out/_next ${{github.workspace}}/es-mx-artifacts + cp -r out/assets ${{github.workspace}}/es-mx-artifacts + cp out/es-MX/*.html ${{github.workspace}}/es-mx-artifacts + cp out/es-MX/*.txt ${{github.workspace}}/es-mx-artifacts + cp out/robots.txt ${{github.workspace}}/es-mx-artifacts + cp out/sitemap.xml ${{github.workspace}}/es-mx-artifacts + - name: Uploading ES-MX artifacts + uses: actions/upload-artifact@v4 + with: + name: production-es-mx + path: ${{github.workspace}}/es-mx-artifacts + if-no-files-found: error + retention-days: 1 + compression-level: 9 + overwrite: true + include-hidden-files: true + s3-deployment: + name: Deployment to S3 + runs-on: ubuntu-latest + needs: website-build + steps: + - name: Configuring AWS credentials + uses: aws-actions/configure-aws-credentials@v4.3.1 + with: + aws-region: ${{secrets.AWS_REGION}} + role-to-assume: ${{secrets.AWS_ROLE_ARN}} + role-session-name: FisoCodesProductionDeployment + - name: Downloading EN-AU artifacts + uses: actions/download-artifact@v4 + with: + name: production-en-au + - name: Syncing EN-AU files to S3 + run: aws s3 sync ./ s3://${{secrets.EN_AU_S3_BUCKET_NAME}} --delete + - name: Downloading ES-MX artifacts + uses: actions/download-artifact@v4 + with: + name: production-es-mx + - name: Syncing ES-MX files to S3 + run: aws s3 sync ./ s3://${{secrets.ES_MX_S3_BUCKET_NAME}} --delete \ No newline at end of file diff --git a/.gitignore b/.gitignore index f03eaec..80e70ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,7 @@ -.yarn/* -!.yarn/patches -!.yarn/plugins -!.yarn/releases -!.yarn/sdks -!.yarn/versions - -# Whether you use PnP or not, the node_modules folder is often used to store -# build artifacts that should be gitignored node_modules - -# Swap the comments on the following lines if you wish to use zero-installs -# In that case, don't forget to run `yarn config set enableGlobalCache false`! -# Documentation here: https://yarnpkg.com/features/caching#zero-installs - -#!.yarn/cache -.pnp.* +.vscode +.next +.env +out +.artifacts +.secrets \ No newline at end of file diff --git a/.husky/commit-msg b/.husky/commit-msg index bf90b32..a4dc436 100644 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1 +1 @@ -yarn commitlint --edit +npx commitlint --edit diff --git a/.husky/pre-commit b/.husky/pre-commit index 4620985..d1aa1c6 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ -yarn ts-standard +npx ts-standard BRANCH=$(git rev-parse --abbrev-ref HEAD) diff --git a/README.md b/README.md index 80d532c..357b3af 100644 --- a/README.md +++ b/README.md @@ -36,26 +36,30 @@ Oscar Figueroa Consulting is a professional website. It is intended to show proj ## Installation -1. Install yarn +1. Install dependencies ```bash - npm install -g corepack + npm install ``` -2. Install dependencies +2. Set enviroment variables + + ``` + DOMAIN="localhost:3000" // Default domain for sitemap + EN_AU_DOMAIN="localhost:3000" + ES_MX_DOMAIN="localhost:3001" + ROBOTS="noindex, nofollow" // For no indexing + ``` +#### Note: DO NOT use protocol in the domains, Next-Intl will NOT recognize the domain properly. + +3. Run project ```bash - yarn install + npm run dev ``` ## Authors - [@fisocodes](https://www.github.com/fisocodes) - -## Acknowledgements - - - Bespan - - ## Contributing Contributions are closed! diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx new file mode 100644 index 0000000..a1d9978 --- /dev/null +++ b/app/[locale]/layout.tsx @@ -0,0 +1,39 @@ +import { NextIntlClientProvider } from 'next-intl' +import { setRequestLocale } from 'next-intl/server' +import { routing } from '@i18n/routing' +import { Metadata } from 'next' +import React from 'react' + +import '../globals.css' +import '@fontsource-variable/oxanium' +import '@fontsource-variable/montserrat' + +export function generateStaticParams (): Array<{ locale: string }> { + return routing.locales.map(locale => ({ locale })) +} + +export const metadata: Metadata = { + robots: process.env.ROBOTS +} + +export default async function LocaleLayout ({ + children, + params +}: { + children: React.ReactNode + params: Promise<{ locale: string }> +}): Promise { + const { locale } = await params + + setRequestLocale(locale) + + return ( + + + + {children} + + + + ) +} diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx new file mode 100644 index 0000000..fd4fadc --- /dev/null +++ b/app/[locale]/page.tsx @@ -0,0 +1,38 @@ +import { HeroSection, CollaborationsSection, TestimonialsSection } from 'app/components' +import Footer from 'app/components/Footer' +import { Metadata } from 'next' +import { getTranslations, setRequestLocale } from 'next-intl/server' +import React from 'react' + +export async function generateMetadata ({ params }: { params: Promise<{ locale: string }> }): Promise { + const { locale } = await params + const t = await getTranslations({ locale, namespace: 'pages.home' }) + return { + title: t('metadata.title'), + description: t('metadata.description'), + alternates: { + canonical: process.env.DOMAIN, + languages: { + 'en-AU': process.env.EN_AU_DOMAIN, + 'es-MX': process.env.ES_MX_DOMAIN + } + } + } +} + +export default async function HomePage ({ params }: { params: Promise<{ locale: string }> }): Promise { + const { locale } = await params + setRequestLocale(locale) + return ( + <> +
+ + + +
+