-
Notifications
You must be signed in to change notification settings - Fork 8
107 lines (89 loc) · 3.13 KB
/
update-sdk-versions.yml
File metadata and controls
107 lines (89 loc) · 3.13 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
106
107
name: Update Ditto SDK Versions
on:
workflow_dispatch:
inputs:
version:
description: "SDK version to update to"
required: true
type: string
default: "4.12.0"
jobs:
update-sdk-versions:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
cache-dependency-path: |
react-native/package-lock.json
react-native-expo/package-lock.json
javascript-tui/package-lock.json
javascript-web/package-lock.json
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "stable"
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup CocoaPods
run: |
sudo gem install cocoapods
pod --version
- name: Update SDK versions and lockfiles
run: node scripts/bump-versions.js -t "${{ github.event.inputs.version }}"
- name: Configure Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Create branch and commit changes
id: create-branch
run: |
BRANCH_NAME="sdk-update-${{ github.event.inputs.version }}-$(date +%Y%m%d-%H%M%S)"
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
git checkout -b "$BRANCH_NAME"
git add -A
if git diff --staged --quiet; then
echo "No changes to commit"
echo "has-changes=false" >> $GITHUB_OUTPUT
else
git commit -m "chore: update Ditto SDK to version ${{ github.event.inputs.version }}"
git push origin "$BRANCH_NAME"
echo "has-changes=true" >> $GITHUB_OUTPUT
fi
- name: Create Draft Pull Request
if: steps.create-branch.outputs.has-changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--title "chore: update Ditto SDK to version ${{ github.event.inputs.version }}" \
--body "$(cat <<'EOF'
Updates all quickstart applications to use Ditto SDK version ${{ github.event.inputs.version }}
- Updates lockfiles where possible
- Excludes Kotlin Multiplatform and Java Spring
EOF
)" \
--draft \
--head "${{ steps.create-branch.outputs.branch-name }}" \
--base main
- name: Output PR URL
if: steps.create-branch.outputs.has-changes == 'true'
run: |
PR_URL=$(gh pr view "${{ steps.create-branch.outputs.branch-name }}" --json url -q .url)
echo "Created draft PR: $PR_URL"