Merge pull request #10 from DesterLib/dev #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release & Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| packages: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| release: | |
| name: Release packages & deploy docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # Fetch full history of the current ref so git operations behave like locally | |
| fetch-depth: 0 | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: Ensure main branch is available | |
| run: git fetch origin main:main | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.0.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "pnpm" | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Generate Prisma Client | |
| run: pnpm --filter=api db:generate | |
| - name: Build Packages | |
| run: pnpm build | |
| - name: Verify Versioning Setup | |
| run: pnpm verify:versioning | |
| - name: Create Release Pull Request or Publish | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| version: pnpm version | |
| publish: pnpm release | |
| commit: "chore: version packages" | |
| title: "chore: version packages" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create GitHub Release | |
| if: steps.changesets.outputs.published == 'true' | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.changesets.outputs.publishedPackages[0].version }} | |
| release_name: Release v${{ steps.changesets.outputs.publishedPackages[0].version }} | |
| body: | | |
| See [Changelog](https://desterlib.github.io/desterlib/changelog) for details. | |
| Package changelogs: | |
| - [API](../blob/main/apps/api/CHANGELOG.md) | |
| - [CLI](../blob/main/packages/cli/CHANGELOG.md) | |
| - [Docs](../blob/main/apps/docs/CHANGELOG.md) | |
| draft: false | |
| prerelease: false | |
| # Build and deploy docs to GitHub Pages only when a new release is published | |
| - name: Setup Pages | |
| if: steps.changesets.outputs.published == 'true' | |
| uses: actions/configure-pages@v4 | |
| - name: Build Docs | |
| if: steps.changesets.outputs.published == 'true' | |
| run: pnpm turbo build --filter=docs | |
| - name: Upload Docs Artifact | |
| if: steps.changesets.outputs.published == 'true' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./apps/docs/dist | |
| - name: Deploy Docs to GitHub Pages | |
| if: steps.changesets.outputs.published == 'true' | |
| uses: actions/deploy-pages@v4 |