-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (84 loc) · 2.83 KB
/
release.yaml
File metadata and controls
105 lines (84 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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