name: Release on: push: branches: - master concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: release: name: Release runs-on: ubuntu-latest permissions: contents: write pull-requests: write steps: - name: Checkout repo uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 cache: npm registry-url: https://registry.npmjs.org - name: Install dependencies run: npm ci - name: Build run: npm run build - name: Create release PR or publish id: changesets uses: changesets/action@v1 with: publish: npm run release version: npm run version-packages title: "chore: version packages" commit: "chore: version packages" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Rename release tag to codeman if: steps.changesets.outputs.published == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | VERSION=$(node -p "require('./package.json').version") OLD_TAG="aicodeman@${VERSION}" NEW_TAG="codeman@${VERSION}" # Retag git tag "$NEW_TAG" "$OLD_TAG" 2>/dev/null || true git tag -d "$OLD_TAG" 2>/dev/null || true git push origin "$NEW_TAG" ":refs/tags/$OLD_TAG" 2>/dev/null || true # Update the GitHub release to use the new tag RELEASE_ID=$(gh release view "$OLD_TAG" --json id -q .id 2>/dev/null || true) if [ -n "$RELEASE_ID" ]; then gh api -X PATCH "repos/${{ github.repository }}/releases/${RELEASE_ID}" \ -f tag_name="$NEW_TAG" \ -f name="$NEW_TAG" fi