From ce00c1e7c851f035ff279986259115f777d0176e Mon Sep 17 00:00:00 2001 From: marcobottaro <39835990+marcobottaro@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:52:09 +0100 Subject: [PATCH] [DEV-1274] Add Update Static Content plugin to Strapi to trigger static site deployment (#686) --- .changeset/olive-pumas-visit.md | 5 + apps/strapi-cms/.env.default | 7 ++ apps/strapi-cms/config/plugins.ts | 10 ++ apps/strapi-cms/package.json | 1 + package-lock.json | 171 ++++++++++++++++++++++++++++++ 5 files changed, 194 insertions(+) create mode 100644 .changeset/olive-pumas-visit.md diff --git a/.changeset/olive-pumas-visit.md b/.changeset/olive-pumas-visit.md new file mode 100644 index 0000000000..5d5b7d5c28 --- /dev/null +++ b/.changeset/olive-pumas-visit.md @@ -0,0 +1,5 @@ +--- +"strapi-cms": minor +--- + +Add Update Static Content plugin to Strapi to trigger static site deployment diff --git a/apps/strapi-cms/.env.default b/apps/strapi-cms/.env.default index 0c52eb03b9..acd3688489 100644 --- a/apps/strapi-cms/.env.default +++ b/apps/strapi-cms/.env.default @@ -37,3 +37,10 @@ AWS_BUCKET_ENDPOINT= AWS_BUCKET_NAME= AWS_BUCKET_FULL_URL= CDN_URL= + +# UPDATE STATIC CONTENT PLUGIN +GITHUB_PERSONAL_ACCESS_TOKEN= +REPO_OWNER= +REPO_NAME= +DEPLOY_WEBSITE_WORKFLOW_ID= +DEPLOY_WEBSITE_TARGET_BRANCH= diff --git a/apps/strapi-cms/config/plugins.ts b/apps/strapi-cms/config/plugins.ts index a118b7aa7b..9e352f4aa6 100644 --- a/apps/strapi-cms/config/plugins.ts +++ b/apps/strapi-cms/config/plugins.ts @@ -17,4 +17,14 @@ export default ({ env }: any) => ({ }, }, }, + 'update-static-content': { + enabled: true, + config: { + githubToken: env('GITHUB_PERSONAL_ACCESS_TOKEN'), + owner: env('REPO_OWNER', 'pagopa'), + repo: env('REPO_NAME', 'developer-portal'), + workflowId: env('DEPLOY_WEBSITE_WORKFLOW_ID', 'deploy_website.yaml'), + branch: env('DEPLOY_WEBSITE_TARGET_BRANCH', 'main'), + }, + }, }); diff --git a/apps/strapi-cms/package.json b/apps/strapi-cms/package.json index 47e40e8e3e..8eed643608 100644 --- a/apps/strapi-cms/package.json +++ b/apps/strapi-cms/package.json @@ -23,6 +23,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^5.3.4", + "strapi-plugin-update-static-content": "^1.0.8", "styled-components": "^5.3.11" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index ab3fc2fd26..fffd78f5d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -203,6 +203,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^5.3.4", + "strapi-plugin-update-static-content": "^1.0.8", "styled-components": "^5.3.11" }, "devDependencies": { @@ -42524,6 +42525,176 @@ "resolved": "apps/strapi-cms", "link": true }, + "node_modules/strapi-plugin-update-static-content": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/strapi-plugin-update-static-content/-/strapi-plugin-update-static-content-1.0.8.tgz", + "integrity": "sha512-/MdKFw2zLhVlMKQwiRmGSMqAdiob/LiX1I2bcPjA7NeWxG2a4MkxlRLwddEjE/vidDcEzDXWiNfRlwps7vzZqw==", + "dependencies": { + "date-fns": "2.29.3", + "react-intl": "6.2.1" + }, + "engines": { + "node": ">=14.19.1 <=18.x.x", + "npm": ">=6.0.0" + }, + "peerDependencies": { + "@strapi/strapi": "^4.4.5" + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/@formatjs/ecma402-abstract": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.13.0.tgz", + "integrity": "sha512-CQ8Ykd51jYD1n05dtoX6ns6B9n/+6ZAxnWUAonvHC4kkuAemROYBhHkEB4tm1uVrRlE7gLDqXkAnY51Y0pRCWQ==", + "dependencies": { + "@formatjs/intl-localematcher": "0.2.31", + "tslib": "2.4.0" + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/@formatjs/fast-memoize": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-1.2.6.tgz", + "integrity": "sha512-9CWZ3+wCkClKHX+i5j+NyoBVqGf0pIskTo6Xl6ihGokYM2yqSSS68JIgeo+99UIHc+7vi9L3/SDSz/dWI9SNlA==", + "dependencies": { + "tslib": "2.4.0" + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/@formatjs/icu-messageformat-parser": { + "version": "2.1.10", + "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.1.10.tgz", + "integrity": "sha512-KkRMxhifWkRC45dhM9tqm0GXbb6NPYTGVYY3xx891IKc6p++DQrZTnmkVSNNO47OEERLfuP2KkPFPJBuu8z/wg==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.13.0", + "@formatjs/icu-skeleton-parser": "1.3.14", + "tslib": "2.4.0" + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/@formatjs/icu-skeleton-parser": { + "version": "1.3.14", + "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.3.14.tgz", + "integrity": "sha512-7bv60HQQcBb3+TSj+45tOb/CHV5z1hOpwdtS50jsSBXfB+YpGhnoRsZxSRksXeCxMy6xn6tA6VY2601BrrK+OA==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.13.0", + "tslib": "2.4.0" + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/@formatjs/intl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@formatjs/intl/-/intl-2.5.1.tgz", + "integrity": "sha512-P01ZGuDDlcN8bHHBCEHspJPvs8WJeO8SXlUIcVGWhS3IN5vUgz0QKUXcKBFnJbEHhONJ+azlObVwvlDKsE+kUg==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.13.0", + "@formatjs/fast-memoize": "1.2.6", + "@formatjs/icu-messageformat-parser": "2.1.10", + "@formatjs/intl-displaynames": "6.1.4", + "@formatjs/intl-listformat": "7.1.3", + "intl-messageformat": "10.2.1", + "tslib": "2.4.0" + }, + "peerDependencies": { + "typescript": "^4.7" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/@formatjs/intl-displaynames": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/@formatjs/intl-displaynames/-/intl-displaynames-6.1.4.tgz", + "integrity": "sha512-sEbziGLsWQo6nA8ZUBcsDRlZzPg+uMVjDmbTalgGqRWLbdXuxMldTYdaCK+UptyJhkmNVM/erz3csTiyqamXHQ==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.13.0", + "@formatjs/intl-localematcher": "0.2.31", + "tslib": "2.4.0" + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/@formatjs/intl-listformat": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@formatjs/intl-listformat/-/intl-listformat-7.1.3.tgz", + "integrity": "sha512-rs0Kxl78PeRCedx2cmFoBqcun2Kf0bCQrF8ycna54sfePpDhMskvODWeI4G/xBioW01FjK7CJSvtJJ87hrr79A==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.13.0", + "@formatjs/intl-localematcher": "0.2.31", + "tslib": "2.4.0" + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/@formatjs/intl-localematcher": { + "version": "0.2.31", + "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.2.31.tgz", + "integrity": "sha512-9QTjdSBpQ7wHShZgsNzNig5qT3rCPvmZogS/wXZzKotns5skbXgs0I7J8cuN0PPqXyynvNVuN+iOKhNS2eb+ZA==", + "dependencies": { + "tslib": "2.4.0" + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/date-fns": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", + "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==", + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/intl-messageformat": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.2.1.tgz", + "integrity": "sha512-1lrJG2qKzcC1TVzYu1VuB1yiY68LU5rwpbHa2THCzA67Vutkz7+1lv5U20K3Lz5RAiH78zxNztMEtchokMWv8A==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.13.0", + "@formatjs/fast-memoize": "1.2.6", + "@formatjs/icu-messageformat-parser": "2.1.10", + "tslib": "2.4.0" + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/react-intl": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/react-intl/-/react-intl-6.2.1.tgz", + "integrity": "sha512-hYxcSamgoA3Mvc55nwhTF1v15T0NUSkaV/EScMNVZXg0kRyaMAoNHkCi9/9H+TnXWNiWrcWH9bjlMlJwrG2V7g==", + "dependencies": { + "@formatjs/ecma402-abstract": "1.13.0", + "@formatjs/icu-messageformat-parser": "2.1.10", + "@formatjs/intl": "2.5.1", + "@formatjs/intl-displaynames": "6.1.4", + "@formatjs/intl-listformat": "7.1.3", + "@types/hoist-non-react-statics": "^3.3.1", + "@types/react": "16 || 17 || 18", + "hoist-non-react-statics": "^3.3.2", + "intl-messageformat": "10.2.1", + "tslib": "2.4.0" + }, + "peerDependencies": { + "react": "^16.6.0 || 17 || 18", + "typescript": "^4.7" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/strapi-plugin-update-static-content/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, + "node_modules/strapi-plugin-update-static-content/node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "optional": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/stream-browserify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz",