Skip to content

Update node.js.yml

Update node.js.yml #11

Workflow file for this run

name: Node.js CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install mkcert
run: |
sudo apt-get update
sudo apt-get install -y libnss3-tools
wget https://dl.filippo.io/mkcert/latest?for=linux/amd64 -O mkcert
chmod +x mkcert
sudo mv mkcert /usr/local/bin/
- name: Set up local CA
run: mkcert -install
- name: Generate certificates
run: npm run makecerts
- name: Trust mkcert CA
run: |
sudo cp "$(mkcert -CAROOT)/rootCA.pem" /usr/local/share/ca-certificates/mkcert-ca.crt
sudo update-ca-certificates
- name: Verify CA installation
run: |
cat /etc/ssl/certs/ca-certificates.crt | grep "$(mkcert -CAROOT)/rootCA.pem"
- name: Export NODE_EXTRA_CA_CERTS
run: echo "NODE_EXTRA_CA_CERTS=$(mkcert -CAROOT)/rootCA.pem" >> $GITHUB_ENV
- name: Build project
run: npm run build --if-present
- name: Run tests
run: npm test
env:
NODE_EXTRA_CA_CERTS: ${{ env.NODE_EXTRA_CA_CERTS }}
NODE_OPTIONS: --use-openssl-ca