Skip to content

Prepare Plugin Releases #3

Prepare Plugin Releases

Prepare Plugin Releases #3

Workflow file for this run

name: Prepare Plugin Releases
on:
workflow_dispatch:
inputs:
proxy_version:
description: 'New 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+$'
env:
GITHUB_TOKEN: ${{ secrets.MOBILE_PLUGIN_RELEASE_PAT }}
jobs:
trigger-releases:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Fetch current proxy version
id: current_proxy
run: |
CURRENT_PROXY_VERSION=$(gh api repos/urbanairship/airship-mobile-framework-proxy/releases/latest \
--header "Authorization: token $GITHUB_TOKEN" --jq '.tag_name')
echo "current_proxy_version=$CURRENT_PROXY_VERSION" >> $GITHUB_OUTPUT
- name: Determine increment type
id: increment_type
run: |
# Parse the old proxy version (CURRENT_PROXY_VERSION) and the new requested proxy version (NEW_PROXY_VERSION).
IFS='.' read -r OLD_MAJOR OLD_MINOR OLD_PATCH <<< "${{ steps.current_proxy.outputs.current_proxy_version }}"
IFS='.' read -r NEW_MAJOR NEW_MINOR NEW_PATCH <<< "${{ github.event.inputs.proxy_version }}"
# Default to patch increment
INC_TYPE="patch"
if [ "$NEW_MAJOR" -gt "$OLD_MAJOR" ]; then
INC_TYPE="major"
elif [ "$NEW_MINOR" -gt "$OLD_MINOR" ]; then
INC_TYPE="minor"
fi
echo "increment_type=$INC_TYPE" >> $GITHUB_OUTPUT
- name: Fetch React Native Version
id: rn
run: |
RN_VERSION=$(gh api repos/urbanairship/react-native-airship/releases/latest \
--header "Authorization: token $GITHUB_TOKEN" --jq '.tag_name')
echo "rn_version=$RN_VERSION" >> $GITHUB_OUTPUT
- name: Fetch Flutter Version
id: flutter
run: |
FLUTTER_VERSION=$(gh api repos/urbanairship/airship-flutter/releases/latest \
--header "Authorization: token $GITHUB_TOKEN" --jq '.tag_name')
echo "flutter_version=$FLUTTER_VERSION" >> $GITHUB_OUTPUT
- name: Fetch Capacitor Version
id: capacitor
run: |
CAPACITOR_VERSION=$(gh api repos/urbanairship/capacitor-airship/releases/latest \
--header "Authorization: token $GITHUB_TOKEN" --jq '.tag_name')
echo "capacitor_version=$CAPACITOR_VERSION" >> $GITHUB_OUTPUT
- name: Fetch Cordova Version
id: cordova
run: |
CORDOVA_VERSION=$(gh api repos/urbanairship/urbanairship-cordova/releases/latest \
--header "Authorization: token $GITHUB_TOKEN" --jq '.tag_name')
echo "cordova_version=$CORDOVA_VERSION" >> $GITHUB_OUTPUT
- name: Bump plugin versions
id: bump_plugins
run: |
function bump_version() {
local ver="$1"
local inc="$2"
IFS='.' read -r maj min pat <<< "$ver"
case "$inc" in
major) ((maj++)); min=0; pat=0;;
minor) ((min++)); pat=0;;
patch) ((pat++));;
esac
echo "${maj}.${min}.${pat}"
}
RN_BUMPED=$(bump_version "${{ steps.rn.outputs.rn_version }}" "${{ steps.increment_type.outputs.increment_type }}")
FLUTTER_BUMPED=$(bump_version "${{ steps.flutter.outputs.flutter_version }}" "${{ steps.increment_type.outputs.increment_type }}")
CAPACITOR_BUMPED=$(bump_version "${{ steps.capacitor.outputs.capacitor_version }}" "${{ steps.increment_type.outputs.increment_type }}")
CORDOVA_BUMPED=$(bump_version "${{ steps.cordova.outputs.cordova_version }}" "${{ steps.increment_type.outputs.increment_type }}")
echo "rn_bumped=$RN_BUMPED" >> $GITHUB_OUTPUT
echo "flutter_bumped=$FLUTTER_BUMPED" >> $GITHUB_OUTPUT
echo "capacitor_bumped=$CAPACITOR_BUMPED" >> $GITHUB_OUTPUT
echo "cordova_bumped=$CORDOVA_BUMPED" >> $GITHUB_OUTPUT
- name: Trigger React Native Release
run: |
gh workflow run prep-release.yml \
-R urbanairship/react-native-airship \
-f react_native_version="${{ steps.bump_plugins.outputs.rn_bumped }}" \
-f proxy_version="${{ github.event.inputs.proxy_version }}" \
$([ -n "${{ github.event.inputs.ios_version }}" ] && echo "-f ios_version=${{ github.event.inputs.ios_version }}") \
$([ -n "${{ github.event.inputs.android_version }}" ] && echo "-f android_version=${{ github.event.inputs.android_version }}")
- name: Trigger Flutter Release
run: |
gh workflow run prep-release.yml \
-R urbanairship/airship-flutter \
-f flutter_version="${{ steps.bump_plugins.outputs.flutter_bumped }}" \
-f proxy_version="${{ github.event.inputs.proxy_version }}" \
$([ -n "${{ github.event.inputs.ios_version }}" ] && echo "-f ios_version=${{ github.event.inputs.ios_version }}") \
$([ -n "${{ github.event.inputs.android_version }}" ] && echo "-f android_version=${{ github.event.inputs.android_version }}")
- name: Trigger Capacitor Release
run: |
gh workflow run prep-release.yaml \
-R urbanairship/capacitor-airship \
-f capacitor_version="${{ steps.bump_plugins.outputs.capacitor_bumped }}" \
-f proxy_version="${{ github.event.inputs.proxy_version }}" \
$([ -n "${{ github.event.inputs.ios_version }}" ] && echo "-f ios_version=${{ github.event.inputs.ios_version }}") \
$([ -n "${{ github.event.inputs.android_version }}" ] && echo "-f android_version=${{ github.event.inputs.android_version }}")
- name: Trigger Cordova Release
run: |
gh workflow run prep-release.yaml \
-R urbanairship/urbanairship-cordova \
-f cordova_version="${{ steps.bump_plugins.outputs.cordova_bumped }}" \
-f proxy_version="${{ github.event.inputs.proxy_version }}" \
$([ -n "${{ github.event.inputs.ios_version }}" ] && echo "-f ios_version=${{ github.event.inputs.ios_version }}") \
$([ -n "${{ github.event.inputs.android_version }}" ] && echo "-f android_version=${{ github.event.inputs.android_version }}")
- name: Handle Success
if: success()
run: echo "Successfully triggered release preparations for all plugins"
- name: Handle Failure
if: failure()
run: |
echo "::error::Failed to trigger one or more plugin releases. Check the logs for details."
exit 1
# - name: Slack Notification (Success)
# if: success()
# uses: homoluctus/slatify@master
# with:
# type: success
# job_name: ":tada: Plugin release preparations triggered :tada:"
# message: "@mobile-team Release preparations have been triggered for all plugins with proxy version v${{ github.event.inputs.proxy_version }} :rocket:"
# url: ${{ secrets.MOBILE_SLACK_WEBHOOK }}
# - name: Slack Notification (Failure)
# if: failure()
# uses: homoluctus/slatify@master
# with:
# type: failure
# job_name: ":disappointed: Plugin Release Preparations Failed :disappointed:"
# message: "@crow Failed to trigger plugin release preparations. Please check the workflow logs. :sob:"
# url: ${{ secrets.MOBILE_SLACK_WEBHOOK }}