ci: fix doesn't create github releases 2 #8
This file contains 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: Main | |
on: | |
push: | |
branches: [main] | |
jobs: | |
check-code: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
- run: pnpm i | |
- run: pnpm run lint:check | |
- run: pnpm run format:check | |
- run: pnpm run type:check | |
stable-release: | |
needs: [check-code] | |
if: ${{ needs.check-code.result == 'success' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
outputs: | |
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
- run: pnpm i | |
- name: Changesets version or deploy and publish on @latest | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
commit: 'chore(release): version packages' | |
title: 'chore(release): version packages' | |
publish: | | |
pnpm build | |
pnpm dlx wrangler pages deploy --project-name=dinui-stable --branch=main ./apps/web/dist | |
pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | |
pnpm changeset publish | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
next-release: | |
needs: [stable-release] | |
if: ${{ needs.stable-release.result == 'success' && needs.stable-release.outputs.hasChangesets == 'true' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
- run: pnpm i | |
- run: pnpm changeset version --snapshot next | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish | |
run: | | |
pnpm build:packages | |
pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | |
pnpm changeset publish --tag next | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |