From faf4f18879be92fac75c65fd98ba0917e35f6ce0 Mon Sep 17 00:00:00 2001 From: rgunindi Date: Sun, 15 Dec 2024 22:05:20 +0100 Subject: [PATCH] Update github workflows --- .github/workflows/release.yml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 66f8ab2..9af3bcd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,13 @@ name: Node.js Package on: + push: + branches: [ main ] release: types: [created] jobs: - build: + build-and-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -13,9 +15,24 @@ jobs: with: node-version: 16 - run: npm ci + - run: npm test + + publish-npm: + needs: build-and-test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: 'https://registry.npmjs.org' + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} publish-gpr: - needs: build + needs: build-and-test runs-on: ubuntu-latest permissions: packages: write @@ -25,9 +42,9 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 16 - registry-url: https://npm.pkg.github.com/ + registry-url: 'https://npm.pkg.github.com' scope: '@rgunindi' - env: - NODE_AUTH_TOKEN: ${{secrets._GITHUB_TOKEN}} - run: npm ci - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets._GITHUB_TOKEN }}