From 4ec5970778547d79696168a983814d34b54dad87 Mon Sep 17 00:00:00 2001 From: Jorge Garcia-Rodriguez Date: Tue, 30 Apr 2024 16:43:36 +0100 Subject: [PATCH 1/3] ci: changing output directory for prod builds to `build` --- .eslintrc.cjs | 2 +- .gitignore | 1 + README.md | 2 +- tsconfig.json | 19 ++++++++++++++----- vite.config.js | 3 +++ 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 85072b8..69a258e 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -7,7 +7,7 @@ module.exports = { "plugin:react-hooks/recommended", "plugin:@tanstack/eslint-plugin-query/recommended", ], - ignorePatterns: ["dist", ".eslintrc.cjs"], + ignorePatterns: ["dist", "build", ".eslintrc.cjs"], parser: "@typescript-eslint/parser", plugins: ["react-refresh"], rules: { diff --git a/.gitignore b/.gitignore index 9fd7e18..1faabbe 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /.pnp .pnp.js dist/ +build/ # testing /coverage diff --git a/README.md b/README.md index b0c0a97..ece245d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ See [Vitest](https://vitest.dev/guide/) for more information. ### `npm run build` -Builds the app for production to the `dist` folder.
+Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
diff --git a/tsconfig.json b/tsconfig.json index de3bc50..d7a70ad 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,15 @@ { "compilerOptions": { + "outDir": "build", "target": "ES2020", "useDefineForClassFields": true, - "lib": ["ES2020", "DOM", "DOM.Iterable"], + "lib": [ + "ES2020", + "DOM", + "DOM.Iterable" + ], "module": "ESNext", "skipLibCheck": true, - /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, @@ -13,13 +17,18 @@ "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", - /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, }, - "include": ["src"], - "references": [{ "path": "./tsconfig.node.json" }], + "include": [ + "src" + ], + "references": [ + { + "path": "./tsconfig.node.json" + } + ], } diff --git a/vite.config.js b/vite.config.js index 9a9954b..8e4356f 100644 --- a/vite.config.js +++ b/vite.config.js @@ -2,5 +2,8 @@ import svgr from "vite-plugin-svgr"; /** @type {import('vite').UserConfig} */ export default { + build: { + outDir: './build' + }, plugins: [svgr()], }; From d6aa051abae776fa475cb090a0810dd2a10522b1 Mon Sep 17 00:00:00 2001 From: Jorge Garcia-Rodriguez Date: Tue, 30 Apr 2024 16:52:14 +0100 Subject: [PATCH 2/3] ci: re-enabling artifact.zip generation --- .github/workflows/main.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3666e2..dea2b22 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,8 +24,21 @@ jobs: env: CI: true + - run: zip -r artifact.zip build + - name: Create Release id: create_release run: npx semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Release Asset for deployment scripts + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./artifact.zip + asset_name: artifact.zip + asset_content_type: application/zip From 223bedc6e3dc1b7447ce04a0db838c449be0b3db Mon Sep 17 00:00:00 2001 From: Jorge Garcia-Rodriguez Date: Tue, 2 Jul 2024 17:57:32 +0100 Subject: [PATCH 3/3] ci: changing the `main` workflow to release only on manual trigger --- .github/workflows/deploy-to-gh-pages.yml | 2 +- .github/workflows/main.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-to-gh-pages.yml b/.github/workflows/deploy-to-gh-pages.yml index a30cd0e..92e5e86 100644 --- a/.github/workflows/deploy-to-gh-pages.yml +++ b/.github/workflows/deploy-to-gh-pages.yml @@ -44,7 +44,7 @@ jobs: - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: './dist' + path: './build' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dea2b22..1f8c4d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,8 @@ name: Release Main on: - push: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: branches: [main] jobs: