From 0942205b369d0da86079d8ef37de93dae4d8bc23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Hlad=C3=ADk?= Date: Fri, 26 Dec 2025 15:35:11 +0100 Subject: [PATCH 1/4] chore(workflows): pr workflow added --- .github/workflows/pull-request.yml | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..42dce93 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,37 @@ +name: Test PR +"on": pull_request + +jobs: + install-and-test: + name: 🛠️ Install & Test + runs-on: ubuntu-latest + + steps: + - name: 🗜️ Checkout + uses: actions/checkout@v6 + + - name: 🗜️ Setup node version + uses: actions/setup-node@v6 + with: + node-version: 24 + registry-url: "https://registry.npmjs.org" + + - name: 🗜️ Setup Zig + uses: mlugg/setup-zig@v2 + with: + version: 0.15.2 + + - name: 🛠️ Install + uses: ./.github/actions/cached-deps + + - name: 🛠️ Clean temporary files + run: yarn clean + + - name: 📦 Build + run: yarn build + + - name: 🛠️ Setup package + run: yarn script:package-npm + + - name: 🛠️ Copy files to dist + run: yarn copy-files From d16201ad74aa651475d529620686c0ea42bc8892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Hlad=C3=ADk?= Date: Fri, 26 Dec 2025 15:40:26 +0100 Subject: [PATCH 2/4] feat(scripts): missing dist fixed --- scripts/package-github.ts | 6 ++++-- scripts/package-npm.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/package-github.ts b/scripts/package-github.ts index e385a0a..6fc1fa6 100644 --- a/scripts/package-github.ts +++ b/scripts/package-github.ts @@ -1,4 +1,4 @@ -import { writeFileSync } from 'fs-extra'; +import { ensureDirSync, writeFileSync } from 'fs-extra'; import { join, resolve } from 'path'; const pkg = require(resolve(__dirname, '..', 'package.json')); @@ -17,6 +17,8 @@ pkg.publishConfig = { registry: 'https://npm.pkg.github.com' }; -writeFileSync(join(__dirname, '..', 'dist', 'package.json'), JSON.stringify(pkg, null, 2)); +const distDir = join(__dirname, '..', 'dist'); +ensureDirSync(distDir); +writeFileSync(join(distDir, 'package.json'), JSON.stringify(pkg, null, 2)); console.log('\x1b[34m', `Package.json in dist/ modified with publishConfig and name.`, '\x1b[0m'); diff --git a/scripts/package-npm.ts b/scripts/package-npm.ts index 36e91fa..5971425 100644 --- a/scripts/package-npm.ts +++ b/scripts/package-npm.ts @@ -1,4 +1,4 @@ -import { writeFileSync } from 'fs-extra'; +import { writeFileSync, ensureDirSync } from 'fs-extra'; import { join, resolve } from 'path'; const pkg = require(resolve(__dirname, '..', 'package.json')); @@ -12,7 +12,9 @@ pkg.bin = { "version-info": "bin/version_info" }; -writeFileSync(join(__dirname, '..', 'dist', 'package.json'), JSON.stringify(pkg, null, 2)); +const distDir = join(__dirname, '..', 'dist'); +ensureDirSync(distDir); +writeFileSync(join(distDir, 'package.json'), JSON.stringify(pkg, null, 2)); console.log('\x1b[34m', 'Package.json in dist/ modified.', '\x1b[0m'); From 1aaea895021523bdf304dcc59c1637e61be95531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Hlad=C3=ADk?= Date: Fri, 26 Dec 2025 15:47:34 +0100 Subject: [PATCH 3/4] chore(workflows): main.yml added --- .github/workflows/main.yml | 78 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..97f18d8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,78 @@ +name: Build & Publish + +on: + push: + tags: + - "v*" + +permissions: + id-token: write # Required for OIDC + contents: read + packages: write + +jobs: + install-and-build: + name: 🛠️ Install & Build + runs-on: ubuntu-latest + + steps: + - name: 🗜️ Checkout + uses: actions/checkout@v6 + + - name: 🗜️ Setup node version + uses: actions/setup-node@v6 + with: + node-version: 24 + registry-url: "https://registry.npmjs.org" + + - name: 🗜️ Setup Zig + uses: mlugg/setup-zig@v2 + with: + version: 0.15.2 + + - name: 🛠️ Install + uses: ./.github/actions/cached-deps + + - name: 🛠️ Clean temporary files + run: yarn clean + + - name: 📦 Build + run: yarn build + + - name: 🛠️ Setup package + run: yarn script:package-npm + + - name: 🛠️ Copy files to dist + run: yarn copy-files + + - name: 🚀 Publish NPM + if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == false + run: cd dist && npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + + - name: 🚀 Publish NPM BETA + if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == true + run: cd dist && npm publish --tag beta + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + + - name: 🛠️ Set up package for GPR + if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == false + run: yarn script:package-github + + - name: 🛠️ Use GPR + if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == false + uses: actions/setup-node@v4 + with: + node-version: 24 + registry-url: https://npm.pkg.github.com/ + scope: "@celtian" + + - name: 🚀 Publish to GitHub Package Registry + if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == false + run: | + cd dist + npm publish + env: + NODE_AUTH_TOKEN: ${{github.token}} From 5ffd252ba9e34c4651cb1fbc4db13c92793994d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Hlad=C3=ADk?= Date: Fri, 26 Dec 2025 15:50:09 +0100 Subject: [PATCH 4/4] fix(workflows): postinstall removed --- .github/actions/cached-deps/action.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/actions/cached-deps/action.yml b/.github/actions/cached-deps/action.yml index bdb0001..2a7956d 100644 --- a/.github/actions/cached-deps/action.yml +++ b/.github/actions/cached-deps/action.yml @@ -4,7 +4,7 @@ inputs: caching: description: Whether to cache dependencies or not required: false - default: 'true' + default: "true" outputs: used-cache: description: Whether the cache was used @@ -31,9 +31,3 @@ runs: yarn install --frozen-lockfile echo "cache='${{ inputs.caching }}'" >> $GITHUB_OUTPUT shell: bash - - - name: Postinstall - if: steps.cache.outputs.cache-hit == 'true' && inputs.caching == 'true' - id: postinstall - run: yarn postinstall - shell: bash