Skip to content

Commit 1d4c047

Browse files
committed
Refactor build & release process
1 parent a84347e commit 1d4c047

7 files changed

Lines changed: 231 additions & 219 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
lib/.gitkeep export-ignore
22
bin/ export-ignore
3+
composer.lock

.github/workflows/build-release.yml

Lines changed: 44 additions & 7 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,15 +25,56 @@ 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
3438
3539
# Store the version, stripping any v-prefix
3640
- name: Write release version
3741
run: |
3842
TAG="${{ github.ref_name }}"
3943
echo "VERSION=${TAG#v}" >> "$GITHUB_ENV"
4044
45+
- name: Setup PHP, with composer and extensions
46+
id: setup-php
47+
# https://github.com/shivammathur/setup-php
48+
uses: shivammathur/setup-php@v2
49+
with:
50+
# Should match the minimum required version for SimpleSAMLphp
51+
php-version: '8.5'
52+
tools: composer:v2
53+
coverage: none
54+
55+
- name: Validate composer.json and composer.lock
56+
run: composer validate
57+
58+
- name: Install Composer dependencies
59+
run: composer install --no-progress --no-dev --prefer-dist --optimize-autoloader
60+
61+
- name: Copy third-party dependencies to lib/ directory
62+
run: |
63+
cp vendor/fredericpetit/highlightjs-composer/assets/js/highlight.min.js lib/highlight.min.js
64+
cp node_modules/pako/dist/browser/pako_inflate.esm.min.mjs lib/pako_inflate.min.js
65+
66+
- name: Clean release
67+
run: |
68+
grep export-ignore .gitattributes | cut -d ' ' -f 1 | while IFS= read -r line
69+
do
70+
rm -rf "$line"
71+
done
72+
rm -rf .git
73+
74+
- name: Build zip-file
75+
run: |
76+
zip -1 -r /tmp/samltracer.zip *
77+
4178
- name: Save release
4279
uses: actions/upload-artifact@v4
4380
with:

.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

bin/build.sh

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

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": {
3+
"fredericpetit/highlightjs-composer": "^11.11"
4+
}
5+
}

0 commit comments

Comments
 (0)