From 9807bf67190477e453a5b0776af2391f89142ee5 Mon Sep 17 00:00:00 2001 From: sushi-chaaaan Date: Sun, 21 Apr 2024 05:04:48 +0900 Subject: [PATCH] feat: add release github actions --- .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a3896d1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release + +on: + push: + branches: + - main + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Setup Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version-file: "package.json" + + - uses: pnpm/action-setup@v3 + with: + run_install: false + + - name: Get pnpm store directory + id: pnpm-store + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ steps.pnpm-store.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install Dependencies + run: pnpm install --frozen-lockfile + + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + # This expects you to have a script called release which does a build for your packages and calls changeset publish + publish: pnpm release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index c76ca94..0f46d89 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "build:eslint": "pnpm --filter @virtual-live-lab/eslint-config build", "build:prettier": "pnpm --filter @virtual-live-lab/prettier-config build", "build": "pnpm run build:eslint && pnpm run build:prettier", - "publish": "pnpm run build && changeset publish && pnpm publish --access public --dry-run" + "release": "pnpm run build && changeset publish" }, "files": [ "dist"