v0.1.0 #1
Workflow file for this run
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: Publish | |
| on: | |
| release: | |
| types: [published] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| name: Publish [npm] | |
| runs-on: ubuntu-latest | |
| environment: NPM | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup | |
| # Setup nodejs for npm publish with OIDC to create .npmrc | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| registry-url: https://registry.npmjs.org | |
| - name: Extract and validate version from tag | |
| id: info | |
| run: | | |
| TAG="${{ github.event.release.tag_name }}" | |
| # Extract version from tag (e.g., "v1.0.0" -> "1.0.0") | |
| if [[ "$TAG" =~ ^v([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?)$ ]]; then | |
| VERSION="${BASH_REMATCH[1]}" | |
| else | |
| echo "Error: Tag must be in format v0.0.0 (e.g., v1.0.0, v1.0.0-beta.1)" | |
| echo "Received: $TAG" | |
| exit 1 | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| # Determine dist-tag based on prerelease suffix | |
| if [[ "$VERSION" == *-* ]]; then | |
| echo "dist_tag=next" >> $GITHUB_OUTPUT | |
| else | |
| echo "dist_tag=latest" >> $GITHUB_OUTPUT | |
| fi | |
| echo "✓ Valid semver tag: v$VERSION (dist-tag: $([ "$VERSION" == *-* ] && echo "next" || echo "latest"))" | |
| - name: Build all packages | |
| run: bun run build | |
| - name: Lint all packages | |
| run: bun run lint | |
| - name: Set version and resolve workspace dependencies | |
| run: | | |
| VERSION="${{ steps.info.outputs.version }}" | |
| sed -i 's/"version": "0.0.0"/"version": "'"$VERSION"'"/g' packages/*/package.json | |
| sed -i 's/"workspace:\*"/"'"$VERSION"'"/g' packages/*/package.json | |
| sed -i 's/"workspace:\*"/"'"$VERSION"'"/g' packages/create-aixyz-app/templates/*/package.json | |
| - name: Publish all packages | |
| run: | | |
| for pkg in packages/*/; do | |
| if [ "$(node -p "require('./$pkg/package.json').private || false")" = "true" ]; then | |
| echo "Skipping private package: $pkg" | |
| continue | |
| fi | |
| npm publish --workspace "$pkg" --access public --tag ${{ steps.info.outputs.dist_tag }} --provenance | |
| done |