ci: Add release workflow #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version name to release. E.g. 4.0.2' | |
required: true | |
env: | |
APK_PATH: app-release.apk | |
APP_ARCHIVE_PATH: sentry_react_native.app.zip | |
jobs: | |
bump-version: | |
runs-on: macos-latest | |
name: 'Release a new React Native Empower Plant version' | |
steps: | |
- name: Set environment variables | |
run: | | |
echo "VERSION=${{ inputs.version || '99.0.0' }}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: package-lock.json | |
- name: Install dependencies | |
run: npm ci | |
- name: Bump Version | |
run: | | |
git checkout -b release/${{ env.VERSION }} | |
npm version ${{ env.VERSION }} | |
git tag --force ${{ env.VERSION }} -m ${{ env.VERSION }} | |
git push origin ${{ env.VERSION }} | |
git push origin release/${{ env.VERSION }} | |
build-android: | |
needs: [bump-version] | |
uses: ./.github/workflows/build-android.yml | |
secrets: inherit | |
with: | |
ref: release/${{ inputs.version || '99.0.0' }} | |
build-ios: | |
needs: [bump-version] | |
uses: ./.github/workflows/build-ios.yml | |
secrets: inherit | |
with: | |
ref: release/${{ inputs.version || '99.0.0' }} | |
publish-release: | |
needs: [bump-version, build-android, build-ios] | |
runs-on: macos-latest | |
steps: | |
- name: Set environment variables | |
run: | | |
echo "VERSION=${{ inputs.version || '99.0.0' }}" >> $GITHUB_ENV | |
- name: Download iOS App | |
uses: actions/download-artifact@v4 | |
with: | |
name: empower-plant-react-native-ios | |
path: ${{ env.APP_ARCHIVE_PATH }} | |
- name: Download Android APK | |
uses: actions/download-artifact@v4 | |
with: | |
name: empower-plant-react-native-android | |
path: ${{ env.APK_PATH }} | |
- name: Create Release | |
run: | | |
gh release create \ | |
${{ env.VERSION }} \ | |
${{ env.APK_PATH }} \ | |
${{ env.APP_ARCHIVE_PATH }} \ | |
--title ${{ env.VERSION }} \ | |
--notes "Release ${{ env.VERSION }}" \ | |
|| error_exit "Failed to create GitHub release." | |
# - name: Merge Release | |
# run: | | |
# git merge release/${{ inputs.version }} | |
# git push origin master |