-
Notifications
You must be signed in to change notification settings - Fork 19
112 lines (99 loc) · 3.85 KB
/
prep-release.yml
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
108
109
110
111
112
name: Prepare Release
on:
workflow_dispatch:
inputs:
flutter_version:
description: 'Airship Flutter Version (x.y.z)'
required: true
pattern: '^\d+\.\d+\.\d+$'
proxy_version:
description: 'Airship Framework Proxy Version (x.y.z)'
required: true
pattern: '^\d+\.\d+\.\d+$'
ios_version:
description: 'iOS SDK Version (x.y.z)'
required: false
pattern: '^\d+\.\d+\.\d+$'
android_version:
description: 'Android SDK Version (x.y.z)'
required: false
pattern: '^\d+\.\d+\.\d+$'
draft:
description: 'Create as draft PR'
type: boolean
default: false
permissions:
contents: write
pull-requests: write
jobs:
prepare-release:
runs-on: macos-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Updates
run: |
./scripts/update_version.sh "${{ github.event.inputs.flutter_version }}" || exit 1
./scripts/update_proxy_version.sh "${{ github.event.inputs.proxy_version }}" || exit 1
if [ -n "${{ github.event.inputs.ios_version }}" ] && [ -n "${{ github.event.inputs.android_version }}" ]; then
./scripts/update_changelog.sh "${{ github.event.inputs.flutter_version }}" "${{ github.event.inputs.proxy_version }}" "${{ github.event.inputs.ios_version }}" "${{ github.event.inputs.android_version }}" || exit 1
fi
- name: Verify Changes
id: verify
run: |
CHANGED_FILES=$(git diff --name-only)
if [ -z "$CHANGED_FILES" ]; then
echo "No files were changed!"
exit 1
fi
echo "Changed files:"
echo "$CHANGED_FILES"
echo "changed_files<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
Release ${{ github.event.inputs.flutter_version }}
- Updates version to ${{ github.event.inputs.flutter_version }}
- Updates Framework Proxy to ${{ github.event.inputs.proxy_version }}
- Updates iOS SDK to ${{ github.event.inputs.ios_version }}
- Updates Android SDK to ${{ github.event.inputs.android_version }}
title: "Release ${{ github.event.inputs.flutter_version }}"
body: |
Release preparation for ${{ github.event.inputs.flutter_version }}
Updates:
- Version: ${{ github.event.inputs.flutter_version }}
- Framework Proxy: ${{ github.event.inputs.proxy_version }}
- iOS SDK: ${{ github.event.inputs.ios_version }}
- Android SDK: ${{ github.event.inputs.android_version }}
## Changed Files
```
${{ steps.verify.outputs.changed_files }}
```
Please verify the changes carefully before merging.
branch: release-${{ github.event.inputs.flutter_version }}
base: main
labels: |
release
automated pr
draft: ${{ github.event.inputs.draft }}
delete-branch: true
- name: Handle Success
if: success() && steps.create-pr.outputs.pull-request-number
run: |
echo "Pull request created successfully"
echo "PR Number: ${{ steps.create-pr.outputs.pull-request-number }}"
echo "PR URL: ${{ steps.create-pr.outputs.pull-request-url }}"
- name: Handle Failure
if: failure()
run: |
echo "::error::Release preparation failed. Please check the logs above for details."
exit 1