chore: Update release workflow for version syncing #76
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 Monorepo Packages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| name: Release changed packages | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| package: | |
| - chimp-core | |
| - git-chimp | |
| - doc-chimp | |
| - release-chimp | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org/' | |
| - name: Configure npm auth | |
| run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
| - name: Install dependencies from root | |
| run: npm ci | |
| - name: Build with Turbo (deps included) | |
| run: npx turbo run build --filter=${{ matrix.package }} | |
| - name: Ensure branch is up-to-date | |
| run: git pull origin main --ff-only | |
| - name: Release with semantic-release | |
| run: npx semantic-release | |
| working-directory: packages/${{ matrix.package }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| sync-versions: | |
| name: Sync Package Versions | |
| runs-on: ubuntu-latest | |
| needs: release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Sync versions with latest tags | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: node scripts/sync-package-versions.js |