Skip to content

Prepare Release

Prepare Release #1

Workflow file for this run

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
# Fail if job runs longer than 15 minutes
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check dependencies
run: |
which sed || exit 1
which git || exit 1
which bash || exit 1
- name: Verify files exist
run: |
for file in scripts/update_version.sh scripts/update_proxy_version.sh scripts/update_changelog.sh; do
if [ ! -f "$file" ]; then
echo "Error: $file not found"
exit 1
fi
done
- name: Set file permissions
run: |
chmod +x scripts/update_version.sh
chmod +x scripts/update_proxy_version.sh
chmod +x scripts/update_changelog.sh
- name: Create Branch
run: |
BRANCH="release/flutter-${{ github.event.inputs.flutter_version }}"
git checkout -b $BRANCH
- name: Update Version
id: version
run: |
if ! ./scripts/update_version.sh ${{ github.event.inputs.flutter_version }}; then
echo "Failed to update version"
exit 1
fi
- name: Update Proxy Version
id: proxy
run: |
if ! ./scripts/update_proxy_version.sh ${{ github.event.inputs.proxy_version }}; then
echo "Failed to update proxy version"
exit 1
fi
- name: Update Changelog
if: inputs.ios_version != '' && inputs.android_version != ''
id: changelog
run: |
if ! ./scripts/update_changelog.sh "${{ github.event.inputs.flutter_version }}" "${{ github.event.inputs.proxy_version }}" "${{ github.event.inputs.ios_version }}" "${{ github.event.inputs.android_version }}"; then
echo "Failed to update changelog"
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"
- 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/flutter-${{ github.event.inputs.flutter_version }}
base: main
labels: |
release
automated pr
draft: ${{ github.event.inputs.draft }}
delete-branch: true
- name: Check PR Creation
if: 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