Skip to content

Commit

Permalink
Read Node.js version from .nvmrc in GitHub Actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
hupf committed Apr 30, 2024
1 parent 9bc847a commit ddda878
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 42 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/bom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:

workflow_dispatch:

env:
NODE_VERSION: 20

jobs:
bom:
runs-on: ubuntu-latest
Expand All @@ -17,10 +14,14 @@ jobs:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE_VERSION }}
- name: Read .nvmrc
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
id: nvm

- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
cache: "npm"

- name: Install @cyclonedx/cyclonedx-npm
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: build 🏭 integrate ⛙ zip 🗜️
name: Build, Integrate & ZIP

on:
push:
branches: [main]

env:
NODE_VERSION: 20

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -21,10 +18,14 @@ jobs:
scripts
key: build-${{ github.sha }}

- name: Use Node.js ${{ env.NODE_VERSION }}
- name: Read .nvmrc
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm

- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
cache: npm

- name: Build 🏭
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/lintAndTest.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Lint & Test

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Read .nvmrc
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm

- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
cache: npm

- name: Lint
run: |
npm install
npm run lint
- name: Test
run: npm run test:headless
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# webapp-schulverwaltung

[![lint/test ✨](https://github.com/bkd-mba-fbi/webapp-schulverwaltung/actions/workflows/lintAndTest.yml/badge.svg?branch=main)](https://github.com/bkd-mba-fbi/webapp-schulverwaltung/actions/workflows/lintAndTest.yml)
[![build/zip 🚀](https://github.com/bkd-mba-fbi/webapp-schulverwaltung/actions/workflows/build.yml/badge.svg)](https://github.com/bkd-mba-fbi/webapp-schulverwaltung/actions/workflows/build.yml)
[![Lint & Test](https://github.com/bkd-mba-fbi/webapp-schulverwaltung/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/bkd-mba-fbi/webapp-schulverwaltung/actions/workflows/test.yml)
[![Build, Integrate & ZIP](https://github.com/bkd-mba-fbi/webapp-schulverwaltung/actions/workflows/build.yml/badge.svg)](https://github.com/bkd-mba-fbi/webapp-schulverwaltung/actions/workflows/build.yml)
[![SBOM](https://github.com/bkd-mba-fbi/webapp-schulverwaltung/actions/workflows/bom.yml/badge.svg?branch=main)](https://github.com/bkd-mba-fbi/webapp-schulverwaltung/actions/workflows/bom.yml)

JavaScript web module to implement processes for school administration using the SLH.Evento backend (REST API).
Expand Down

0 comments on commit ddda878

Please sign in to comment.