Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release' into lagoon-slb-146
Browse files Browse the repository at this point in the history
  • Loading branch information
dspachos committed Apr 10, 2024
2 parents eb673a9 + 625a716 commit 130535a
Show file tree
Hide file tree
Showing 31 changed files with 5,698 additions and 4,503 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Deploy
on:
push:
branches:
- prod
- dev

jobs:
test:
name: Deploy
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup
uses: ./.github/actions/setup

- run: pwd
working-directory: ${{ runner.home }}

- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Prepare deployment package
run: pnpm turbo:prep && pnpm deploy --filter "@custom/website" ../deploy --prod
env:
VITE_DECAP_REPO: ${{ github.repository }}
VITE_DECAP_BRANCH: ${{ steps.extract_branch.outputs.branch }}

- name: Build
run: pnpm run --filter @custom/website build
working-directory: ../deploy
env:
CLOUDINARY_API_KEY: ${{ vars.CLOUDINARY_API_KEY }}
CLOUDINARY_API_SECRET: ${{ secrets.CLOUDINARY_API_SECRET }}
CLOUDINARY_CLOUDNAME: ${{ secrets.CLOUDINARY_CLOUDNAME }}
GATSBY_PUBLIC_URL: ${{ vars.GATSBY_PUBLIC_URL }}

- name: Check for Netlify auth token
id: netlify-check
shell: bash
run: |
if [ "${{ secrets.NETLIFY_AUTH_TOKEN }}" != '' ]; then
echo "available=true" >> $GITHUB_OUTPUT;
else
echo "available=false" >> $GITHUB_OUTPUT;
fi
- name: Deploy to dev
run: pnpm netlify deploy --prod --filter "@custom/website"
working-directory: ../deploy
if: github.ref == 'refs/heads/dev' && steps.netlify-check.outputs.available == 'true' && vars.NETLIFY_DEV_ID != ''
env:
NETLIFY_SITE_ID: ${{ vars.NETLIFY_DEV_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}

- name: Deploy to prod
run: pnpm netlify deploy --prod --filter "@custom/website"
working-directory: ../deploy
if: github.ref == 'refs/heads/prod' && steps.netlify-check.outputs.available == 'true' && vars.NETLIFY_PROD_ID != ''
env:
NETLIFY_SITE_ID: ${{ vars.NETLIFY_PROD_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}

11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ jobs:
path: tests/e2e/playwright-report/
retention-days: 3

- name: Check for Chromatic project token
id: chromatic-check
shell: bash
run: |
if [ "${{ secrets.CHROMATIC_PROJECT_TOKEN }}" != '' ]; then
echo "available=true" >> $GITHUB_OUTPUT;
else
echo "available=false" >> $GITHUB_OUTPUT;
fi
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
Expand All @@ -49,6 +59,7 @@ jobs:
storybookBaseDir: packages/ui
onlyChanged: true
exitOnceUploaded: true
if: ${{ steps.chromatic-check.outputs.available == 'true' }}

- name: Deploy storybook to netlify
run:
Expand Down
1 change: 1 addition & 0 deletions .idea/silverback-template.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion INIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ replace(
'# ' + process.env.PROJECT_NAME_HUMAN,
);
replace(
'apps/cms/config/sync/system.site.yml',
[
'apps/cms/config/sync/system.site.yml',
'tests/schema/specs/content.spec.ts',
'tests/e2e/specs/drupal/metatags.spec.ts',
],
'Silverback Drupal Template',
process.env.PROJECT_NAME_HUMAN,
);
Expand Down
1 change: 1 addition & 0 deletions apps/cms/gatsby-config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const plugins = [
drupal_external_url:
// File requests are proxied through netlify.
process.env.NETLIFY_URL || 'http://127.0.0.1:8000',

graphql_path: '/graphql',
auth_key: 'cfdb0555111c0f8924cecab028b53474',
type_prefix: '',
Expand Down
4 changes: 2 additions & 2 deletions apps/decap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
},
"dependencies": {
"@amazeelabs/cloudinary-responsive-image": "^1.6.15",
"@amazeelabs/graphql-directives": "^1.3.2",
"@amazeelabs/gatsby-plugin-static-dirs": "^1.0.1",
"@amazeelabs/graphql-directives": "^1.3.2",
"@custom/schema": "workspace:*",
"@custom/ui": "workspace:*",
"decap-cms-app": "^3.0.12",
Expand All @@ -35,7 +35,7 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@amazeelabs/decap-cms-backend-token-auth": "^1.1.1",
"@amazeelabs/decap-cms-backend-token-auth": "^1.1.7",
"@types/node": "^18",
"@types/react": "^18.2.46",
"@types/react-dom": "^18.2.18",
Expand Down
21 changes: 17 additions & 4 deletions apps/decap/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,30 @@ CMS.registerPreviewStyle(css, { raw: true });
CMS.registerWidget('uuid', UuidWidget);
CMS.registerBackend('token-auth', TokenAuthBackend);

if (
window.location.hostname !== 'localhost' &&
!import.meta.env.DEV &&
(!import.meta.env.VITE_DECAP_REPO || !import.meta.env.VITE_DECAP_BRANCH)
) {
console.error(
"VITE_DECAP_REPO and VITE_DECAP_BRANCH environment variables are missing. Can't connect to the repository.",
);
}

CMS.init({
config: {
publish_mode: 'simple',
load_config_file: false,
publish_mode: 'editorial_workflow',
media_folder: 'apps/decap/media',
// @ts-ignore
backend: import.meta.env.DEV
? {
// In development, use the in-memory backend.
name: 'test-repo',
}
: window.location.hostname === 'localhost'
: window.location.hostname === 'localhost' ||
!import.meta.env.VITE_DECAP_REPO ||
!import.meta.env.VITE_DECAP_BRANCH
? {
// On localhost, use the proxy backend that writes to files.
name: 'proxy',
Expand All @@ -41,8 +54,8 @@ CMS.init({
// Otherwise, its production. Use the token auth backend.
name: 'token-auth',
api_root: '/.netlify/functions/github-proxy',
repo: 'AmazeeLabs/silverback-template',
branch: 'prod',
repo: import.meta.env.VITE_DECAP_REPO,
branch: import.meta.env.VITE_DECAP_BRANCH,
},
i18n: {
structure: 'single_file',
Expand Down
19 changes: 0 additions & 19 deletions apps/website/gatsby-node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,6 @@ export const createPages = async ({ actions }) => {
statusCode: 404,
});

// Proxy Drupal webforms.
Object.values(Locale).forEach((locale) => {
actions.createRedirect({
fromPath: `/${locale}/form/*`,
toPath: `${process.env.GATSBY_DRUPAL_URL}/${locale}/form/:splat`,
statusCode: 200,
});
});

// Additionally proxy themes and modules as they can have additional
// non-aggregated assets.
['themes', 'modules'].forEach((path) => {
actions.createRedirect({
fromPath: `/${path}/*`,
toPath: `${process.env.GATSBY_DRUPAL_URL}/${path}/:splat`,
statusCode: 200,
});
});

// Any unhandled requests are handed to strangler, which will try to pass
// them to all registered legacy systems and return 404 if none of them
// respond.
Expand Down
1 change: 1 addition & 0 deletions apps/website/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
directory = "netlify/functions"

[build]
publish = "public"
edge_functions = "netlify/edge-functions"

[functions.strangler]
Expand Down
10 changes: 5 additions & 5 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
"private": true,
"dependencies": {
"@amazeelabs/bridge-gatsby": "^1.2.7",
"@amazeelabs/decap-cms-backend-token-auth": "^1.1.1",
"@amazeelabs/token-auth-middleware": "^1.1.1",
"@amazeelabs/cloudinary-responsive-image": "^1.6.15",
"@amazeelabs/decap-cms-backend-token-auth": "^1.1.7",
"@amazeelabs/gatsby-plugin-operations": "^1.1.3",
"@amazeelabs/gatsby-plugin-static-dirs": "^1.0.1",
"@amazeelabs/gatsby-source-silverback": "^1.13.17",
"@amazeelabs/gatsby-source-silverback": "^1.14.0",
"@amazeelabs/publisher": "^2.4.17",
"@amazeelabs/strangler-netlify": "^1.1.9",
"@amazeelabs/token-auth-middleware": "^1.1.1",
"@custom/cms": "workspace:*",
"@custom/decap": "workspace:*",
"@custom/schema": "workspace:*",
"@custom/ui": "workspace:*",
"@custom/cms": "workspace:*",
"gatsby": "^5.13.1",
"gatsby-plugin-layout": "^4.13.0",
"gatsby-plugin-manifest": "^5.13.0",
Expand All @@ -32,8 +32,8 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@netlify/functions": "^2.6.0",
"@netlify/edge-functions": "^2.3.1",
"@netlify/functions": "^2.6.0",
"@testing-library/react": "^14.1.2",
"@types/react": "^18.2.46",
"@types/react-dom": "^18.2.18",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"vitest": "^1.1.1"
},
"resolutions": {
"gatsby-plugin-sharp": "5.13.1",
"sharp": "0.33.1",
"eslint": "7",
"graphql": "16.8.1"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ translations:
value: false
body:
-
value: "<!-- wp:custom/hero {\"mediaEntityIds\":[\"3a0fe860-a6d6-428a-9474-365bd57509aa\"],\"headline\":\"Architektur\",\"lead\":\"Unsere Architektur f\\u00fcr entkoppelte Websites\"} /-->\r\n\r\n<!-- wp:custom/content -->\r\n<!-- wp:drupalmedia/drupal-media-entity {\"mediaEntityIds\":[\"72187a1f-3e48-4b45-a9b7-189c6fd7ee26\"],\"caption\":\"Skizze der entkoppelten Architektur\"} /-->\r\n<!-- /wp:custom/content -->"
value: |-
<!-- wp:custom/hero {"mediaEntityIds":["3a0fe860-a6d6-428a-9474-365bd57509aa"],"headline":"Architektur","lead":"Unsere Architektur f\u00fcr entkoppelte Websites"} /-->
<!-- wp:custom/content -->
<!-- wp:drupalmedia/drupal-media-entity {"mediaEntityIds":["72187a1f-3e48-4b45-a9b7-189c6fd7ee26"],"caption":"Skizze der entkoppelten Architektur"} /-->
<!-- /wp:custom/content -->
format: gutenberg
summary: ''
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ default:
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><a href="/node/50a28359-32f7-48ee-9577-330d79a2b62c" data-type="Content: Basic page" data-id="50a28359-32f7-48ee-9577-330d79a2b62c">link to page</a></p>
<p><a href="/node/50a28359-32f7-48ee-9577-330d79a2b62c" data-type="Content: Basic page" data-id="50a28359-32f7-48ee-9577-330d79a2b62c" data-entity-type="node">link to page</a></p>
<!-- /wp:paragraph -->
<!-- /wp:custom/content -->
format: gutenberg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ translations:
value: false
body:
-
value: "<!-- wp:custom/hero {\"headline\":\"Privatsph\\u00e4re\",\"lead\":\"... oder das Fehlen davon.\"} /-->\r\n\r\n<!-- wp:custom/content -->\r\n<!-- wp:paragraph -->\r\n<p></p>\r\n<!-- /wp:paragraph -->\r\n<!-- /wp:custom/content -->"
value: |-
<!-- wp:custom/hero {"headline":"Privatsph\u00e4re","lead":"... oder das Fehlen davon."} /-->
<!-- wp:custom/content -->
<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->
<!-- /wp:custom/content -->
format: gutenberg
summary: ''
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ translations:
value: false
body:
-
value: "<!-- wp:custom/hero {\"headline\":\"404 - Nicht gefunden\",\"lead\":\"Die Seite die sie gerne h\\u00e4tten is grade nicht da.\"} /-->\r\n\r\n<!-- wp:custom/content -->\r\n<!-- wp:paragraph -->\r\n<p></p>\r\n<!-- /wp:paragraph -->\r\n<!-- /wp:custom/content -->"
value: |-
<!-- wp:custom/hero {"headline":"404 - Nicht gefunden","lead":"Die Seite die sie gerne h\u00e4tten is grade nicht da."} /-->
<!-- wp:custom/content -->
<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->
<!-- /wp:custom/content -->
format: gutenberg
summary: ''
Loading

0 comments on commit 130535a

Please sign in to comment.