diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index fa44468..5d37370 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - token: ${{ secrets.CHRIS_PERSONAL_ACCESS_TOKEN }} + token: ${{ github.token }} - name: Setup Node.js uses: actions/setup-node@v4 @@ -31,22 +31,28 @@ jobs: git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" npx changeset version - git push + if [ -n "$(git status --porcelain)" ]; then + git add . + git commit -m "Version packages" + git push + else + echo "No changes to commit" + fi env: - GITHUB_TOKEN: ${{ secrets.CHRIS_PERSONAL_ACCESS_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} - name: Check Version Change id: version_check env: - GITHUB_TOKEN: ${{ secrets.CHRIS_PERSONAL_ACCESS_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} run: | CURRENT_VERSION=$(node -p "require('./package.json').version") LATEST_RELEASE=$(gh release list --limit 1 | cut -f1) LATEST_VERSION=${LATEST_RELEASE#v} - + echo "Current version: ${CURRENT_VERSION}" echo "Latest release: ${LATEST_VERSION}" - + if [ "$(printf '%s\n' "$LATEST_VERSION" "$CURRENT_VERSION" | sort -V | tail -n1)" = "$CURRENT_VERSION" ] && [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then echo "Version increment detected" echo "should_release=true" >> $GITHUB_OUTPUT @@ -59,7 +65,7 @@ jobs: - name: Create GitHub Release if: steps.version_check.outputs.should_release == 'true' env: - GITHUB_TOKEN: ${{ secrets.CHRIS_PERSONAL_ACCESS_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} run: | CURRENT_VERSION=$(node -p "require('./package.json').version") gh release create "v${CURRENT_VERSION}" \