From 93104455491bc5b27881c39d63921e16b994f62f Mon Sep 17 00:00:00 2001 From: Wesley Ford Date: Sat, 18 Nov 2023 19:53:15 -0600 Subject: [PATCH 1/5] fix(action): generate certs --- .../{react.yml.old.txt => react.yml} | 23 ++++++++++++------- .../ClientApp/aspnetcore-https.js | 6 +++++ 2 files changed, 21 insertions(+), 8 deletions(-) rename .github/workflows/{react.yml.old.txt => react.yml} (58%) diff --git a/.github/workflows/react.yml.old.txt b/.github/workflows/react.yml similarity index 58% rename from .github/workflows/react.yml.old.txt rename to .github/workflows/react.yml index da30dd4..676a8e2 100644 --- a/.github/workflows/react.yml.old.txt +++ b/.github/workflows/react.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - name: Ensure React Project Builds on: @@ -8,32 +5,42 @@ on: branches: ["dev", "main"] pull_request: branches: ["dev", "main"] + env: DOTNET_CORE_VERSION: 8.0.x WORKING_DIRECTORY: ./src/EducationTrail/ClientApp + jobs: build: runs-on: ubuntu-latest strategy: matrix: - # omits 14.x because some of our devDependencies require 16.x or higher node-version: [18.x, 20.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v4 + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ env.DOTNET_CORE_VERSION }} + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} cache: "npm" + - name: Generate and Install ASP.NET Cert run: | - dotnet dev-certs https --clean - dotnet dev-certs https --export-path ~/.aspnet/https --format Pem --no-password + dotnet dev-certs https --clean + dotnet dev-certs https --export-path ~/.aspnet/https --format Pem --no-password + + - name: Rename Certificate and Key Files + run: | + mv ~/.aspnet/https/localhost.crt ~/.aspnet/https/react-ts.pem + mv ~/.aspnet/https/localhost.key ~/.aspnet/https/react-ts.key + - name: Test vite+react Project run: | npm ci --prefix "${{ env.WORKING_DIRECTORY }}" diff --git a/src/EducationTrail/ClientApp/aspnetcore-https.js b/src/EducationTrail/ClientApp/aspnetcore-https.js index 9e58786..7627e0f 100644 --- a/src/EducationTrail/ClientApp/aspnetcore-https.js +++ b/src/EducationTrail/ClientApp/aspnetcore-https.js @@ -20,6 +20,12 @@ if (!certificateName) { const certFilePath = path.join(baseFolder, `${certificateName}.pem`); const keyFilePath = path.join(baseFolder, `${certificateName}.key`); +console.log(baseFolder); +console.log(certificateArg); +console.log(certificateName); +console.log(certFilePath); +console.log(keyFilePath); + if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) { spawn('dotnet', [ 'dev-certs', From d0d1b0855f98f16584ccc06a228de0e13b57790d Mon Sep 17 00:00:00 2001 From: Wesley Ford Date: Sat, 18 Nov 2023 19:56:16 -0600 Subject: [PATCH 2/5] Update react.yml --- .github/workflows/react.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/react.yml b/.github/workflows/react.yml index 676a8e2..eb4a473 100644 --- a/.github/workflows/react.yml +++ b/.github/workflows/react.yml @@ -38,9 +38,10 @@ jobs: - name: Rename Certificate and Key Files run: | + mkdir -p ~/.aspnet/https mv ~/.aspnet/https/localhost.crt ~/.aspnet/https/react-ts.pem mv ~/.aspnet/https/localhost.key ~/.aspnet/https/react-ts.key - + - name: Test vite+react Project run: | npm ci --prefix "${{ env.WORKING_DIRECTORY }}" From acfd4c10d6208693f80db7e21a4750eae19de0c9 Mon Sep 17 00:00:00 2001 From: Wesley Ford Date: Sat, 18 Nov 2023 19:58:04 -0600 Subject: [PATCH 3/5] Update react.yml --- .github/workflows/react.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/react.yml b/.github/workflows/react.yml index eb4a473..9e31281 100644 --- a/.github/workflows/react.yml +++ b/.github/workflows/react.yml @@ -39,8 +39,8 @@ jobs: - name: Rename Certificate and Key Files run: | mkdir -p ~/.aspnet/https - mv ~/.aspnet/https/localhost.crt ~/.aspnet/https/react-ts.pem - mv ~/.aspnet/https/localhost.key ~/.aspnet/https/react-ts.key + mv ~/.aspnet/https/localhost.crt ~/.aspnet/https/react-ts.pem || true + mv ~/.aspnet/https/localhost.key ~/.aspnet/https/react-ts.key || true - name: Test vite+react Project run: | From 149751883503eddd20a47f395b583524cda072d2 Mon Sep 17 00:00:00 2001 From: Wesley Ford Date: Sat, 18 Nov 2023 19:59:10 -0600 Subject: [PATCH 4/5] Update react.yml --- .github/workflows/react.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/react.yml b/.github/workflows/react.yml index 9e31281..c6a6289 100644 --- a/.github/workflows/react.yml +++ b/.github/workflows/react.yml @@ -38,9 +38,10 @@ jobs: - name: Rename Certificate and Key Files run: | - mkdir -p ~/.aspnet/https - mv ~/.aspnet/https/localhost.crt ~/.aspnet/https/react-ts.pem || true - mv ~/.aspnet/https/localhost.key ~/.aspnet/https/react-ts.key || true + mkdir -p ./.aspnet/https + mv ./.aspnet/https/localhost.crt ./.aspnet/https/react-ts.pem || true + mv ./.aspnet/https/localhost.key ./.aspnet/https/react-ts.key || true + working-directory: ${{ github.workspace }} - name: Test vite+react Project run: | From 5130bbf0a88c4cd3c2e7f67d099e065f3191ae36 Mon Sep 17 00:00:00 2001 From: Wesley Ford Date: Sat, 18 Nov 2023 20:05:38 -0600 Subject: [PATCH 5/5] Update aspnetcore-https.js --- src/EducationTrail/ClientApp/aspnetcore-https.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/EducationTrail/ClientApp/aspnetcore-https.js b/src/EducationTrail/ClientApp/aspnetcore-https.js index 7627e0f..bd7e5d3 100644 --- a/src/EducationTrail/ClientApp/aspnetcore-https.js +++ b/src/EducationTrail/ClientApp/aspnetcore-https.js @@ -39,6 +39,9 @@ if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) { .on('exit', (code) => process.exit(code)); } +console.log(certFilePath); +console.log(keyFilePath); + module.exports = { certFilePath, keyFilePath