File tree Expand file tree Collapse file tree 3 files changed +38
-5
lines changed Expand file tree Collapse file tree 3 files changed +38
-5
lines changed Original file line number Diff line number Diff line change 11name : Release
22on :
33 workflow_dispatch :
4+ inputs :
5+ version_name :
6+ description : ' The version name to release. E.g. 24.12.31'
7+ required : true
8+ default : null
9+ version_code :
10+ description : ' The version code (numeric) to release. E.g. 241231'
11+ required : true
12+ default : null
13+ schedule :
14+ - cron : " 0 0 * * 0" # Runs every Sunday at midnight
415
516jobs :
617 empower-plant-release :
1627 distribution : ' temurin'
1728 java-version : ' 17'
1829
19- - name : Run Deploy Script
20- run : ./deploy_project.sh
30+ - name : Setup Automatic Version Name And Code
31+ if : inputs.version_name == null
32+ run : |
33+ echo "VERSION_NAME=$(date +'%y.%m.%d')" >> $GITHUB_ENV
34+ echo "VERSION_CODE=$(date +'%y%m%d')" >> $GITHUB_ENV
35+ shell : sh
36+
37+ - name : Run Deploy Script (manual version)
38+ if : inputs.version_name != null
39+ run : ./deploy_project.sh ${{ inputs.version_name }}
40+ shell : sh
41+ env :
42+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43+ SENTRY_AUTH_TOKEN : ${{ secrets.SENTRY_AUTH_TOKEN }}
44+ VERSION_NAME : ${{ inputs.version_name }}
45+ VERSION_CODE : ${{ inputs.version_code }}
46+
47+ - name : Run Deploy Script (automatic version)
48+ if : inputs.version_name == null
49+ run : ./deploy_project.sh "$(date +'%y.%m.%d')"
2150 shell : sh
2251 env :
2352 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change @@ -38,8 +38,8 @@ android {
3838 applicationId " com.example.vu.android"
3939 minSdkVersion 21
4040 targetSdkVersion 29
41- versionCode 48
42- versionName " 2.11.3"
41+ versionCode System . getenv( ' VERSION_CODE ' ) ?. toInteger() ?: 48
42+ versionName System . getenv( ' VERSION_NAME ' ) ?: " 2.11.3"
4343
4444 testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
4545 externalNativeBuild {
Original file line number Diff line number Diff line change @@ -9,8 +9,12 @@ if ! command -v gh &> /dev/null; then
99 error_exit " gh is not installed, make sure you run 'make init' (see README.md)."
1010fi
1111
12+ # When this script is called from release workflow, the version is passed as an argument, otherwise it will be read from the app/build.gradle file
13+ PACKAGE_VERSION=$1
14+ if [ -z " $1 " ]; then
15+ PACKAGE_VERSION=$( grep ' versionName' app/build.gradle | awk -F\" {' print $2' })
16+ fi
1217PACKAGE_NAME=$( grep ' applicationId' app/build.gradle | awk -F\" {' print $2' })
13- PACKAGE_VERSION=$( grep ' versionName' app/build.gradle | awk -F\" {' print $2' })
1418REPO=sentry-demos/android
1519
1620# Check if current version was already released
You can’t perform that action at this time.
0 commit comments