diff --git a/.gitattributes b/.gitattributes index 2f264dd..01331f0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1 @@ lib/.gitkeep export-ignore -node_modules export-ignore -package.json export-ignore -package-lock.json export-ignore -webpack.config.js export-ignore diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index eb00553..b9bc234 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -8,10 +8,71 @@ on: # yamllint disable-line rule:truthy - '*' workflow_dispatch: +env: + HLJS_VERSION: 11.9.0 + PAKO_VERSION: 2.1.0 + jobs: + build-hljs: + name: Build dependencies + runs-on: [ubuntu-latest] + strategy: + fail-fast: false + + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - uses: actions/checkout@v4 + with: + repository: 'highlightjs/highlight.js' + ref: ${{ env.HLJS_VERSION }} + + - name: Custom build Highlight.js + run: | + node tools/build.js xml properties http + + - name: 'Upload Hightlight.js build' + uses: actions/upload-artifact@v4 + with: + name: hljs + path: build/highlight.min.js + retention-days: 1 + + build-pako: + name: Build dependencies + runs-on: [ubuntu-latest] + strategy: + fail-fast: false + + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - uses: actions/checkout@v4 + with: + repository: 'nodeca/pako' + ref: "${{ env.PAKO_VERSION }}" + + - name: Custom build Pako + run: | + npm install --package-lock-only + npm clean-install + npm run build + + - name: 'Upload Pako build' + uses: actions/upload-artifact@v4 + with: + name: pako + path: dist/pako.min.js + retention-days: 1 + build: name: Build release runs-on: [ubuntu-latest] + needs: [build-hljs, build-pako] strategy: fail-fast: false @@ -26,20 +87,22 @@ jobs: - name: Fetch changes # Without fetching, we might miss new tags due to caching in Github Actions run: git fetch --all - - uses: actions/setup-node@v4 + + - uses: actions/download-artifact@v4 with: - node-version: 20 + name: hljs + path: lib/ - - name: Install & build assets - run: | - npx npm-check-updates -u - # Make sure the lock-file is up to date before we run clean-install - npm install --package-lock-only - npm clean-install - npm audit fix + - uses: actions/download-artifact@v4 + with: + name: pako + path: lib/ - cp node_modules/@highlightjs/cdn-assets/highlight.min.js lib/ - cp node_modules/pako/dist/pako_inflate.js lib/pako_inflate.min.js + - uses: geekyeggo/delete-artifact@v4 + with: + name: | + hljs + pako # Store the version, stripping any v-prefix - name: Write release version diff --git a/.gitignore b/.gitignore index f40a255..8bde85f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -node_modules -package-lock.json lib/*.js diff --git a/package.json b/package.json deleted file mode 100644 index cb1a5a2..0000000 --- a/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "SAML-tracer", - "repository": "https://github.com/simplesamlphp/SAML-tracer", - "license": "BSD-2-Clause", - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "dependencies": { - "@highlightjs/cdn-assets": "^11.9.0", - "pako": "^2.1.0" - } -}