|
| 1 | +# This workflow will release the packages with Changesets |
| 2 | + |
| 3 | +name: 🚀 Release |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + |
| 13 | +env: |
| 14 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 15 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 16 | + |
| 17 | +jobs: |
| 18 | + release: |
| 19 | + name: 🚀 Release |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + os: [ubuntu-latest] |
| 23 | + node-version: [lts/*] |
| 24 | + pnpm-version: [latest] |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + steps: |
| 27 | + - name: ⬇️ Checkout |
| 28 | + id: checkout |
| 29 | + |
| 30 | + with: |
| 31 | + token: ${{ env.GITHUB_TOKEN }} |
| 32 | + fetch-depth: 0 |
| 33 | + |
| 34 | + - name: 🟢 Setup node |
| 35 | + id: setup-node |
| 36 | + uses: actions/setup-node@v2 |
| 37 | + with: |
| 38 | + node-version: ${{ matrix.node-version }} |
| 39 | + |
| 40 | + - name: 🥡 Setup pnpm |
| 41 | + id: setup-pnpm |
| 42 | + |
| 43 | + with: |
| 44 | + version: ${{ matrix.pnpm-version }} |
| 45 | + run_install: false |
| 46 | + |
| 47 | + - name: 🎈 Get pnpm store directory |
| 48 | + id: get-pnpm-cache-dir |
| 49 | + run: | |
| 50 | + echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" |
| 51 | +
|
| 52 | + - name: 🔆 Cache pnpm modules |
| 53 | + uses: actions/cache@v3 |
| 54 | + id: pnpm-cache |
| 55 | + with: |
| 56 | + path: ${{ steps.get-pnpm-cache-dir.outputs.pnpm_cache_dir }} |
| 57 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 58 | + restore-keys: | |
| 59 | + ${{ runner.os }}-pnpm-store- |
| 60 | +
|
| 61 | + - name: 🧩 Install Dependencies |
| 62 | + id: install-dependencies |
| 63 | + run: pnpm install |
| 64 | + |
| 65 | + - name: 🏗️ Build |
| 66 | + id: build-the-mono-repo |
| 67 | + run: pnpm build |
| 68 | + |
| 69 | + - name: 📣 Create Release Pull Request or Publish to npm |
| 70 | + id: changesets |
| 71 | + uses: changesets/action@v1 |
| 72 | + with: |
| 73 | + title: "chore(release): version packages 🦋" |
| 74 | + publish: pnpm publish:packages |
| 75 | + version: pnpm version:packages |
| 76 | + commit: "chore(release): version packages 🦋 [skip ci]" |
| 77 | + env: |
| 78 | + GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} |
| 79 | + NPM_TOKEN: ${{ env.NPM_TOKEN }} |
0 commit comments