From 45d5126baeee93cc349a5795501ac54c57ab7b87 Mon Sep 17 00:00:00 2001 From: AriPerkkio Date: Sun, 17 Mar 2024 17:41:54 +0200 Subject: [PATCH] ci: add snapshot release --- .github/workflows/release.yml | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 603fc7f..7eb1b57 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,13 +7,15 @@ on: type: choice description: Type of the release options: + - snapshot - patch - minor - major jobs: - build: + publish-release: runs-on: ubuntu-latest + if: ${{ github.event.inputs.release-type != 'snapshot' }} steps: - uses: actions/checkout@v4 with: @@ -54,3 +56,35 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + publish-snapshot: + runs-on: ubuntu-latest + if: ${{ github.event.inputs.release-type == 'snapshot' }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v3 + with: + node-version: '18' + registry-url: 'https://registry.npmjs.org' + + - name: Install pnpm + uses: pnpm/action-setup@v2 + + - name: Install + run: pnpm install + + - name: Build + run: pnpm build + + - name: Bump snapshot version + if: + run: npm --no-git-tag-version version ${npm_package_version}-snapshot-${GIT_COMMIT} + + - name: Bump snapshot version + if: + run: npm publish --tag snapshot + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}