Skip to content

fix: update version field in package.json to 0.0.2 #5

fix: update version field in package.json to 0.0.2

fix: update version field in package.json to 0.0.2 #5

Workflow file for this run

name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: write
pull-requests: write
issues: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
# Use the default token
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 23
- name: Setup Yarn
run: corepack enable
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Build packages
run: yarn build
- name: Create Release Pull Request or Version Packages
id: changesets
uses: changesets/action@v1
with:
# Only handle versioning, no publishing since packages are private
version: yarn changeset:version
commit: "chore: version packages"
title: "chore: version packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Git Tags and Releases
if: steps.changesets.outputs.hasChangesets == 'false'
run: |
# Configure git with the proper authentication
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Check for version changes and create tags
changed_packages=$(git diff HEAD~1 --name-only | grep 'package\.json$' || true)
if [ ! -z "$changed_packages" ]; then
echo "Found changed packages: $changed_packages"
for package_file in $changed_packages; do
if [[ "$package_file" == packages/*/package.json ]]; then
echo "Processing package: $package_file"
name=$(node -p "require('./$package_file').name")
version=$(node -p "require('./$package_file').version")
if [ "$version" != "0.0.0" ]; then
tag_name="${name}@${version}"
echo "Creating tag: $tag_name"
# Create tag locally
git tag "$tag_name"
# Create GitHub release using gh CLI
gh release create "$tag_name" \
--title "Release $tag_name" \
--notes "Release of $name version $version" \
--target main || echo "Release creation failed for $tag_name"
fi
fi
done
# Push all tags at once
echo "Pushing tags to origin..."
git push origin --tags || echo "Failed to push tags"
else
echo "No package.json changes detected"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}