Skip to content

update-from-platform #7

update-from-platform

update-from-platform #7

Workflow file for this run

name: πŸ”„ Update Nitro CLI Version
on:
repository_dispatch:
types:
- update-from-platform
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: πŸ§ͺ Validate payload
shell: bash
run: |
if [ -z "${{ github.event.client_payload.version }}" ]; then
echo "Missing client_payload.version"
exit 1
fi
- name: πŸ“₯ Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: 🧰 Enable Corepack
run: |
corepack enable
corepack prepare yarn@4.2.2 --activate
yarn --version
- name: 🧰 Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
cache: yarn
cache-dependency-path: yarn.lock
- name: πŸ“¦ Install dependencies
run: yarn install --immutable
- name: πŸ“ Update version in package.json
run: npm version "${{ github.event.client_payload.version }}" --no-git-tag-version
- name: πŸ—οΈ Build
run: yarn build
- name: πŸ“ Commit changes
id: commit
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "has_changes=false" >> "$GITHUB_OUTPUT"
echo "No changes to commit."
else
git commit -m "Update Nitro CLI to ${{ github.event.client_payload.version }}"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
fi
- name: πŸ“€ Push commit
if: steps.commit.outputs.has_changes == 'true'
run: git push
- name: 🏷️ Update version tags
shell: bash
run: |
VERSION="${{ github.event.client_payload.version }}"
git tag "v${VERSION}" --force
git push origin "v${VERSION}" --force
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
MAJOR=$(echo "$VERSION" | cut -d. -f1)
git tag "v${MAJOR}" --force
git push origin "v${MAJOR}" --force
fi
- name: πŸš€ Create GitHub release for stable versions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
VERSION="${{ github.event.client_payload.version }}"
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Preview version detected ($VERSION). Skipping release creation."
exit 0
fi
TAG="v${VERSION}"
if gh release view "$TAG" >/dev/null 2>&1; then
echo "Release $TAG already exists. Skipping creation."
exit 0
fi
gh release create "$TAG" \
--title "$TAG" \
--verify-tag