Skip to content

Commit 226a881

Browse files
authored
Feature/refactor build (#110)
* Refactor build & release process * Bump dependencies for CI * Fix composer-file by adding the bare necessities * Fix file-path * Bump upload-artifact * Remove node_modules from release * Restore license * Remove bin-directory from .gitattributes; no longer used * Get highlight.js from node instead of composer * Strip unnecessary files from zip-archive
1 parent a84347e commit 226a881

8 files changed

Lines changed: 224 additions & 229 deletions

File tree

.gitattributes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
lib/.gitkeep export-ignore
2-
bin/ export-ignore
2+
node_modules/ export-ignore
3+
test/ export-ignore
4+
vendor/ export-ignore
5+
package-lock.json export-ignore

.github/workflows/build-release.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ jobs:
1414
runs-on: [ubuntu-latest]
1515

1616
steps:
17-
- uses: actions/setup-node@v4
18-
with:
19-
node-version: 20
20-
21-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v6
2218
with:
2319
token: ${{ secrets.SAMLTRACER_BUILD_TOKEN }}
2420
ref: ${{ github.head_ref || github.ref_name }}
@@ -29,17 +25,44 @@ jobs:
2925
# Without fetching, we might miss new tags due to caching in Github Actions
3026
run: git fetch --all
3127

32-
- name: Run build-script
33-
run: bin/build.sh
28+
- uses: actions/setup-node@v6
29+
with:
30+
node-version: 24
31+
32+
- name: Install & build assets
33+
run: |
34+
# Make sure the lock-file is up to date before we run clean-install
35+
npm install --package-lock-only
36+
npm clean-install
37+
npm audit fix
38+
39+
- name: Build custom (minimum) release of highlight.js
40+
run: |
41+
cd node_modules/highlight.js
42+
npm install --package-lock-only
43+
npm clean-install
44+
npm run build
45+
node tools/build.js xml properties http
46+
47+
- name: Copy third-party dependencies to lib/ directory
48+
run: |
49+
cp node_modules/highlight.js/build/highlight.min.js lib/highlight.min.js
50+
cp node_modules/pako/dist/pako_inflate.min.js lib/pako_inflate.min.js
51+
52+
- name: Clean release
53+
run: |
54+
grep export-ignore .gitattributes | cut -d ' ' -f 1 | while IFS= read -r line
55+
do
56+
rm -rf "$line"
57+
done
58+
rm -rf .git
3459
35-
# Store the version, stripping any v-prefix
36-
- name: Write release version
60+
- name: Build zip-file
3761
run: |
38-
TAG="${{ github.ref_name }}"
39-
echo "VERSION=${TAG#v}" >> "$GITHUB_ENV"
62+
zip -1 -r /tmp/samltracer.zip *
4063
4164
- name: Save release
42-
uses: actions/upload-artifact@v4
65+
uses: actions/upload-artifact@v7
4366
with:
4467
name: release
4568
path: "/tmp/samltracer.zip"

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v6
1717

18-
- uses: actions/setup-node@v4
18+
- uses: actions/setup-node@v6
1919
with:
20-
node-version: 20
20+
node-version: 26
2121

2222
- name: Install dependencies
2323
run: npm ci

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
lib/*.js
22
node_modules/
3+
vendor/
4+
composer.lock

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2011-2014, UNINETT AS
1+
Copyright (c) 2011-2026, SimpleSAMLphp
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

bin/build.sh

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)