From 12cff5e043df706d1672cbdd60fc7156f53bb93b Mon Sep 17 00:00:00 2001 From: Tmk Date: Sat, 6 Jul 2024 17:39:29 +0800 Subject: [PATCH] feat: add release ci workflow --- .github/workflows/ci.yml | 1 + .github/workflows/release.yml | 59 +++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eabef121..ca14f259 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,7 @@ concurrency: jobs: test: + name: Test timeout-minutes: 15 strategy: matrix: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..4c6ef673 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +name: Release + +on: + workflow_dispatch: + +permissions: + id-token: write + +jobs: + release: + name: Release + runs-on: ubuntu-latest + env: + NPM_CONFIG_PROVENANCE: true + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/cache@v3 + with: + path: .nx + key: nx-${{ runner.os }}-${{ github.sha }} + restore-keys: | + nx-${{ runner.os }}- + + - uses: pnpm/action-setup@v3 + + - uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: pnpm + + - uses: nrwl/nx-set-shas@v4 + # This line is needed for nx affected to work when CI is running on a PR + - name: Fetch NX base + run: | + git fetch --all + + - name: Install deps + run: | + pnpm i --frozen-lockfile + + - name: Creating .npmrc + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + + - id: changesets + uses: changesets/action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + commit: "chore: $(date +'%Y-%m-%d') release" + title: "chore: $(date +'%Y-%m-%d') release" + publish: pnpm publish