From 31ab24d3e4eef130b96a5dc32fec5562ae4bd7c2 Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Thu, 29 Jun 2023 10:23:36 +0200 Subject: [PATCH] Add Publish GitHub Actions workflow --- .github/workflows/ci.yml | 3 -- .github/workflows/publish.yml | 52 +++++++++++++++++++++++++++++++++++ package.json | 3 +- 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9247448..0b6dd34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean install of node dependencies and run tests -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - name: CI on: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..3c6f2c0 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,52 @@ +name: Publish + +on: + release: + types: [published] + +permissions: + id-token: write + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Cache .yarn/cache + uses: actions/cache@v3 + env: + cache-name: yarn-cache + with: + path: .yarn/cache + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ env.cache-name }} + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Enable Corepack + run: corepack enable + + - name: Install dependencies + run: yarn --immutable + env: + HUSKY: 0 + + - name: Publish with latest tag + if: github.event.release.prelease == false + run: yarn npm publish --tag latest + env: + YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish with next tag + if: github.event.release.prelease == true + run: yarn npm publish --tag next + env: + YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 59bdf71..6513da0 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,8 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0" }, "publishConfig": { - "access": "public" + "access": "public", + "provenance": true }, "files": [ "dist", -- 2.51.2