Skip to content

Prepare Release

Prepare Release #3

name: Prepare Release
on:
workflow_dispatch:
inputs:
distribution-version:
description: 'Distribution Version of the release'
default: 'patch'
required: true
type: string
jobs:
update-native-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: master
- name: Update version in package.json
id: version
run: |
npm version ${{ inputs.distribution-version }} --no-git-tag-version
echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
- name: Get version from latest CocoaPods release of ApptentiveKit iOS
id: ios-version
run: |
IOS_VERSION=$(curl -s "https://cocoapods.org/pods/ApptentiveKit" | sed -n 's/.*<h1>ApptentiveKit <span>\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/p')
echo "ios_version=$IOS_VERSION" >> $GITHUB_OUTPUT
- name: Update ApptentiveKit iOS dependency
run: .scripts/update_ios_version.sh apptentive-react-native.podspec "${{ steps.ios-version.outputs.ios_version }}"
- name: Get version from latest Maven release of ApptentiveKit Android
id: android-version
run: echo "android_version=$(curl -s 'https://search.maven.org/solrsearch/select?q=g:com.apptentive+AND+a:apptentive-kit-android&wt=json' | jq -r '.response.docs[0].latestVersion')" >> $GITHUB_OUTPUT
- name: Update ApptentiveKit Android dependency
run: .scripts/update_android_version.sh android/build.gradle "${{ steps.android-version.outputs.android_version }}"
- name: Check version numbers
uses: actions/github-script@v4
with:
script: |
if( "${{steps.version.outputs.version}}" == "" || "${{steps.ios-version.outputs.ios_version}}" == "" || "${{steps.android-version.outputs.android_version}}" == "" ){
core.setFailed('One or more version numbers are empty.')
}
- name: Update CHANGELOG.md
id: changelog
run: |
.scripts/add_changelog_entry.sh "${{ steps.version.outputs.version }}" "${{ steps.android-version.outputs.android_version }}" "${{ steps.ios-version.outputs.ios_version }}" \
> .scripts/changes.md
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: "Release ${{ steps.version.outputs.version }}"
committer: "Alchemer Mobile Team <sdks@apptentive.com>"
branch: "releases/${{ steps.version.outputs.version }}"
base: master
title: "Release ${{ steps.version.outputs.version }}"
body-path: .scripts/changes.md