From 1648f46545bd438e2b59e01b1349d86a82f2fb71 Mon Sep 17 00:00:00 2001 From: harry Date: Mon, 9 Oct 2023 20:21:23 +0100 Subject: [PATCH] ci((release)): add release workflow to main branch Adds a release workflow to automate releases when pushing to the main branch --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) 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..4431cf6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release +on: + push: + branches: + - main +jobs: + cache-and-install: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + release: + runs-on: ubuntu-latest + needs: cache-and-install + steps: + - name: Configure git user + run: | + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + + - name: Release + run: pnpm release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}