|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 9 | + |
| 10 | +permissions: {} |
| 11 | + |
| 12 | +jobs: |
| 13 | + release: |
| 14 | + name: Release |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + # prevents this action from running on forks |
| 18 | + if: github.repository == 'goknsh/svelte-query-pocketbase' |
| 19 | + |
| 20 | + permissions: |
| 21 | + contents: write # to push commits and tags (changesets/action) |
| 22 | + pull-requests: write # to create pull request (changesets/action) |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout Repo |
| 26 | + uses: actions/checkout@v3 |
| 27 | + with: |
| 28 | + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits |
| 29 | + fetch-depth: 0 |
| 30 | + |
| 31 | + # Global dependencies are not cached, we use pnpm cache instead |
| 32 | + - name: Setup Node.js |
| 33 | + uses: actions/setup-node@v3 |
| 34 | + with: |
| 35 | + node-version: 18.x |
| 36 | + |
| 37 | + - name: Install pnpm |
| 38 | + uses: pnpm/action-setup@v2.2.4 |
| 39 | + with: |
| 40 | + run_install: false |
| 41 | + version: 7.26.0 |
| 42 | + |
| 43 | + - name: Get pnpm store directory |
| 44 | + id: pnpm-cache |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT |
| 48 | +
|
| 49 | + - name: Setup pnpm cache |
| 50 | + uses: actions/cache@v3 |
| 51 | + with: |
| 52 | + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} |
| 53 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 54 | + restore-keys: | |
| 55 | + ${{ runner.os }}-pnpm-store- |
| 56 | +
|
| 57 | + - name: Install dependencies |
| 58 | + run: pnpm install --frozen-lockfile |
| 59 | + |
| 60 | + - name: Create Release Pull Request or Publish to npm |
| 61 | + id: changesets |
| 62 | + uses: changesets/action@v1 |
| 63 | + with: |
| 64 | + publish: pnpm run release |
| 65 | + commit: 'chore: version package' |
| 66 | + title: 'chore: version package' |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments