Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
fix(action): generate certs
Browse files Browse the repository at this point in the history
  • Loading branch information
wesdevpro committed Nov 19, 2023
1 parent 3e75b79 commit 9310445
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,39 +1,46 @@
# 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:
push:
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 }}"
Expand Down
6 changes: 6 additions & 0 deletions src/EducationTrail/ClientApp/aspnetcore-https.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 9310445

Please sign in to comment.