Skip to content

Commit 12cb3ee

Browse files
authored
Merge pull request #3392 from anyproto/ios-4693-implement-lane-for-update-middleware-version
IOS-4693 CI | Add lane for update middleware on ci for any branch
2 parents 2099de3 + 04b59d7 commit 12cb3ee

File tree

3 files changed

+110
-2
lines changed

3 files changed

+110
-2
lines changed

.github/workflows/generator_checks.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121
uses: actions/cache/restore@v4
2222
with:
2323
path: build
24-
key: build-local-tools
24+
key: build-local-tools-${{ github.sha }}
25+
restore-keys: |
26+
build-local-tools-
2527
2628
- name: Setup tools
2729
run: make setup-env

.github/workflows/update_cache.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ jobs:
4848
uses: actions/cache/save@v4
4949
with:
5050
path: build
51-
key: build-local-tools
51+
key: build-local-tools-${{ github.sha }}
52+
restore-keys: |
53+
build-local-tools-
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Update middleware version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
middle_version:
7+
description: "Middleware version"
8+
required: true
9+
type: string
10+
task_name:
11+
description: "Task name (e.g. IOS-123)"
12+
required: false
13+
type: string
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
main:
21+
name: Update build cache
22+
runs-on: macos-15
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
28+
- name: Restore cache for local build folder
29+
uses: actions/cache/restore@v4
30+
with:
31+
path: build
32+
key: build-local-tools-${{ github.sha }}
33+
restore-keys: |
34+
build-local-tools-
35+
36+
- name: Prepare deps
37+
uses: ./.github/actions/prepare-deps
38+
39+
- name: Xcode Cache
40+
uses: irgaly/xcode-cache@v1
41+
with:
42+
key: xcode-cache-deriveddata-${{ github.sha }}
43+
restore-keys: xcode-cache-deriveddata-
44+
swiftpm-cache-key: spm-soucepackages-${{ hashFiles('Anytype.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
45+
swiftpm-cache-restore-keys: spm-soucepackages-
46+
cache-read-only: true
47+
48+
- name: Setup Xcode
49+
uses: maxim-lobanov/[email protected]
50+
with:
51+
xcode-version: '16.1'
52+
53+
- name: Setup tools
54+
run: make setup-env
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Update Middleware Version
59+
run: make set-middle-version v=${{ inputs.middle_version }}
60+
61+
- name: Download Middleware and Generate Files
62+
run: make setup-middle
63+
env:
64+
MIDDLEWARE_TOKEN: ${{ secrets.MIDDLEWARE_TOKEN }}
65+
66+
- name: Update git config
67+
uses: ./.github/actions/update-git-config
68+
69+
- name: Create Commit
70+
id: commit
71+
run: |
72+
BRANCH_NAME="${{ inputs.task_name != '' && format('{0}-update-middleware-{1}', inputs.task_name, inputs.middle_version) || format('update-middleware-{0}', inputs.middle_version) }}"
73+
COMMIT_MESSAGE="${{ inputs.task_name != '' && format('{0} Automation: Update middleware to {1}', inputs.task_name, inputs.middle_version) || format('Automation: Update middleware to {0}', inputs.middle_version) }}"
74+
75+
# Delete local branch if exists
76+
git branch -D $BRANCH_NAME || true
77+
# Delete remote branch if exists
78+
git push origin --delete $BRANCH_NAME || true
79+
# Create new branch
80+
git checkout -b $BRANCH_NAME
81+
git add .
82+
git commit -m "$COMMIT_MESSAGE" --no-verify
83+
84+
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
85+
echo "commit_message=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
89+
- name: Run unit tests
90+
run: bundle exec fastlane tests skip_notify:true
91+
env:
92+
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 900
93+
FASTLANE_XCODE_LIST_TIMEOUT: 900
94+
95+
- name: Create and Merge PR
96+
run: |
97+
git push origin ${{ steps.commit.outputs.branch_name }} --no-verify
98+
99+
PR_BODY="This PR updates middleware to version ${{ inputs.middle_version }}"
100+
gh pr create --title "${{ steps.commit.outputs.commit_message }}" --body "$PR_BODY" --base ${{ github.ref_name }}
101+
gh pr merge ${{ steps.commit.outputs.branch_name }} --squash --delete-branch
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+

0 commit comments

Comments
 (0)