From 2a6541db7e8cd0752327b20f01ad4c330bf43462 Mon Sep 17 00:00:00 2001 From: WofWca Date: Fri, 6 Nov 2020 17:05:26 +0800 Subject: [PATCH 1/2] chore: add GitHub action to auto-publish to NPM --- .github/workflows/npm-publish.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/npm-publish.yml diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..a07623a --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,19 @@ +name: Publish to NPM + +on: + push: + branches: + - master + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} From d7661d920ab4bdc1f9c31651f32e0446b8427c92 Mon Sep 17 00:00:00 2001 From: WofWca Date: Fri, 6 Nov 2020 17:28:14 +0800 Subject: [PATCH 2/2] chore: don't run the publish job if package.json didn't change --- .github/workflows/npm-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index a07623a..c63461a 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -4,6 +4,8 @@ on: push: branches: - master + paths: + - package.json # If this didn't change, the package version didn't change. jobs: publish-npm: