From bd3ed97af1777d26f5c0fd897639175abc49cf82 Mon Sep 17 00:00:00 2001 From: zyc9012 Date: Fri, 5 Apr 2024 15:34:06 +0800 Subject: [PATCH] Support publishing npm package via CI --- .github/workflows/ci.yml | 18 +++++++++--------- .github/workflows/release.yml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 678e9ed5..4af6e9ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,12 +4,12 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 16 - cache: 'yarn' - - run: yarn install --frozen-lockfile - - run: yarn tsc - - run: yarn lint - - run: yarn test \ No newline at end of file + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20.x" + cache: "yarn" + - run: yarn install --frozen-lockfile + - run: yarn tsc + - run: yarn lint + - run: yarn test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..67233fb3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Release + +on: push +# on: +# release: +# types: [published] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20.x" + registry-url: "https://registry.npmjs.org" + cache: "yarn" + - run: yarn install --frozen-lockfile + - run: yarn tsc + - run: yarn lint + - run: yarn test + - run: yarn build + - run: cd packages/core && npm pack + - run: cd packages/react && npm pack + - uses: actions/upload-artifact@v4 + with: + name: packages + path: | + packages/core/fortune-sheet-core-*.tgz + packages/react/fortune-sheet-react-*.tgz + # - run: npm publish + # env: + # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}