From e399682cadce827807a1af7726eee677a33b4e55 Mon Sep 17 00:00:00 2001 From: himself65 Date: Thu, 20 Apr 2023 17:45:45 -0500 Subject: [PATCH] ci: add `release.yml` --- .github/workflows/release.yml | 19 +++++++++++++++++++ .yarnrc.yml | 2 +- packages/y-indexeddb/package.json | 1 + scripts/publish.sh | 18 ++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100755 scripts/publish.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..9886311c21 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,19 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + release: + name: Publish npm release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup Node.js + uses: ./.github/actions/setup-node + - name: Try publishing to NPM + run: ./scripts/publish.sh + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.yarnrc.yml b/.yarnrc.yml index 455f7cd3a7..8ce6ff24c5 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -2,7 +2,7 @@ nmMode: hardlinks-local nodeLinker: node-modules -npmAuthToken: '${NODE_AUTH_TOKEN:-NONE}' +npmAuthToken: '${NPM_TOKEN:-NONE}' npmPublishAccess: public diff --git a/packages/y-indexeddb/package.json b/packages/y-indexeddb/package.json index 9adbc4e8c4..d90677c833 100644 --- a/packages/y-indexeddb/package.json +++ b/packages/y-indexeddb/package.json @@ -12,6 +12,7 @@ ".": "./src/index.ts" }, "publishConfig": { + "access": "public", "main": "dist/index.umd.cjs", "module": "dist/index.js", "exports": { diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100755 index 0000000000..a4a2deedca --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +packages=( + "y-indexeddb" +) + +for package in "${packages[@]}"; do + cd "packages/$package" + yarn build + + if [ "$NIGHTLY" = "true" ]; then + yarn npm publish --no-git-checks --tag nightly + else + yarn npm publish + fi + + cd ../../ +done