|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*.*.*" |
| 7 | + - "v*.*.*" |
| 8 | + |
| 9 | +jobs: |
| 10 | + release: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + environment: production |
| 13 | + steps: |
| 14 | + - name: Checkout Repository |
| 15 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 16 | + with: |
| 17 | + fetch-depth: 0 # Full history for changelog generation |
| 18 | + |
| 19 | + - name: Setup Node.js |
| 20 | + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 |
| 21 | + with: |
| 22 | + node-version-file: ".nvmrc" |
| 23 | + |
| 24 | + - name: Use corepack to activate pnpm |
| 25 | + run: npm i -g corepack@0.31.0 && corepack enable |
| 26 | + shell: bash |
| 27 | + |
| 28 | + - name: Audit dependencies (before installing anything) |
| 29 | + # Ignore "low" and "moderate" advisories for now. |
| 30 | + run: pnpm audit --audit-level high |
| 31 | + shell: bash |
| 32 | + |
| 33 | + - name: Get pnpm store directory (for caching) |
| 34 | + id: pnpm-cache-dir |
| 35 | + run: | |
| 36 | + echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT |
| 37 | + shell: bash |
| 38 | + |
| 39 | + # https://github.com/actions/cache |
| 40 | + - name: Setup pnpm store cache |
| 41 | + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 |
| 42 | + with: |
| 43 | + path: ${{ steps.pnpm-cache-dir.outputs.dir }} |
| 44 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 45 | + restore-keys: | |
| 46 | + ${{ runner.os }}-pnpm-store- |
| 47 | + env: |
| 48 | + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5 |
| 49 | + |
| 50 | + - name: Audit the lockfiles to catch peer dependency issues |
| 51 | + run: pnpm install -r --lockfile-only |
| 52 | + shell: bash |
| 53 | + |
| 54 | + - name: Install dependencies |
| 55 | + run: pnpm install -r --frozen-lockfile |
| 56 | + shell: bash |
| 57 | + |
| 58 | + - name: Create PR with changelog |
| 59 | + uses: changesets/action@06245a4e0a36c064a573d4150030f5ec548e4fcc # v1.4.10 |
| 60 | + with: |
| 61 | + version: pnpm run changeset version # Updates versions and changelog |
| 62 | + # publish: pnpm run changeset publish # Publishes to npm |
| 63 | + env: |
| 64 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For changelog links |
| 65 | + # NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # For npm publish |
0 commit comments