diff --git a/.github/workflows/browser.yml b/.github/workflows/browser.yml deleted file mode 100644 index 775d855..0000000 --- a/.github/workflows/browser.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Browser Integration - -on: - push: - branches: [ dev ] - pull_request: - branches: [ dev ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 22.x - - run: npm install && cd example/browser && npm install - - run: docker run --name seq -d -p 5341:80 -e ACCEPT_EULA=Y -e SEQ_FIRSTRUN_NOAUTHENTICATION=true datalust/seq:latest - - run: cd example/browser && npm run test:html - - run: docker rm -f seq diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..22ba129 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +# Builds and tests the package. Successful runs on `main` trigger `publish.yml`. + +name: CI + +on: + push: + branches: [ dev, main ] + pull_request: + branches: [ dev ] + +permissions: + contents: read + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + node-version: [22.x, 24.x, 26.x] + os: [ubuntu-latest, windows-latest, macOS-latest] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run build --if-present + - run: npm test + - run: npm run typecheck + + browser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22.x + - run: npm install && cd example/browser && npm install + - run: docker run --name seq -d -p 5341:80 -e ACCEPT_EULA=Y -e SEQ_FIRSTRUN_NOAUTHENTICATION=true datalust/seq:latest + - run: cd example/browser && npm run test:html + - run: docker rm -f seq diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 0b980c5..0000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,32 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Test - -on: - push: - branches: [ dev ] - pull_request: - branches: [ dev ] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [22.x, 24.x, 26.x] - os: [ubuntu-latest, windows-latest, macOS-latest] - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - - run: npm run build --if-present - - run: npm test - - run: npm run typecheck - \ No newline at end of file diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml deleted file mode 100644 index 35df635..0000000 --- a/.github/workflows/npm-publish.yml +++ /dev/null @@ -1,34 +0,0 @@ -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created -# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages - -name: Publish - -on: - push: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 18 - - run: npm ci - - run: npm test - - publish-npm: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 18 - registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..34877ce --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +# Publishes the package to npm using trusted publishing (OIDC) after a successful CI run on `main` +# For more information see: https://docs.npmjs.com/trusted-publishers + +name: Publish + +on: + workflow_run: + workflows: [ CI ] + types: [ completed ] + branches: [ main ] + +permissions: + contents: read + +jobs: + publish-npm: + if: >- + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.event == 'push' && + github.event.workflow_run.head_repository.full_name == github.repository + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # Required for npm trusted publishing + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_sha }} + - uses: actions/setup-node@v4 + with: + node-version: 24.x + registry-url: https://registry.npmjs.org/ + - run: npm install -g npm@latest + - run: npm publish