From 11af12f120f9db7dca6c03a416d47fa196f03689 Mon Sep 17 00:00:00 2001 From: Danyal Aytekin Date: Thu, 26 Oct 2023 11:29:41 +0100 Subject: [PATCH 1/3] Add publishing workflow --- .github/workflows/publish.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d3385f3 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +on: + release: + types: [created, edited, published] + workflow_dispatch: + inputs: + dryRun: + description: "Dry run only" + required: true + default: true + type: boolean + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: "https://registry.npmjs.org" + - run: npm ci + + - name: Publish package + env: + NODE_AUTH_TOKEN: ${{ secrets.REGISTRY_PUBLISH_TOKEN }} + if: > + (github.event_name == 'release' && github.event.action == 'published') || + (github.event_name == 'workflow_dispatch' && !inputs.dryRun) + run: npm publish + + - name: Publish package (dry run) + env: + NODE_AUTH_TOKEN: ${{ secrets.REGISTRY_PUBLISH_TOKEN }} + if: > + (github.event_name == 'release' && github.event.action != 'published') || + (github.event_name == 'workflow_dispatch' && inputs.dryRun) + run: npm publish --dry-run From a62a430db0014ccaa4ca39bc5479ec4e09221b7d Mon Sep 17 00:00:00 2001 From: Danyal Aytekin Date: Thu, 26 Oct 2023 11:30:05 +0100 Subject: [PATCH 2/3] Remove `master` branch push trigger for test workflow --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d30ccf7..5be7396 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,7 +1,6 @@ on: push: branches: - - master - main pull_request: From c0fe2bae119236fcfabac1ac9e8d00397afeb577 Mon Sep 17 00:00:00 2001 From: Danyal Aytekin Date: Fri, 27 Oct 2023 15:14:39 +0100 Subject: [PATCH 3/3] Update publisher's Node version to 20 from 16 --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d3385f3..65d2f58 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20 registry-url: "https://registry.npmjs.org" - run: npm ci