Skip to content

Commit 776c17c

Browse files
committedMay 24, 2023
YOLO attempt CI script fix by close and releasing in same gradle invocation.
1 parent eaeb7b3 commit 776c17c

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed
 

‎.github/workflows/release.yml

+3-10
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
run: ./ci unit_tests
4040

4141
# Publish after successful build and unit tests
42-
publish_to_sonatype:
42+
publish_browser_switch:
4343
needs: [ build_aar, unit_test_browser_switch ]
4444
name: Publish To Sonatype
4545
runs-on: ubuntu-latest
@@ -55,22 +55,15 @@ jobs:
5555
- name: Update Version
5656
run: ./ci update_version ${{ github.event.inputs.version }}
5757
- name: Publish Browser Switch
58-
run: ./ci publish_to_sonatype
59-
env:
60-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
61-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
62-
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
63-
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
64-
- name: Close and Release Repository
65-
run: ./ci close_and_release_repository
58+
run: ./ci publish release
6659
env:
6760
SONATYPE_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
6861
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
6962
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
7063
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
7164

7265
release_finished:
73-
needs: [ publish_to_sonatype ]
66+
needs: [ publish_browser_switch ]
7467
name: Release Finished
7568
runs-on: ubuntu-latest
7669
steps:

‎.github/workflows/release_snapshot.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ jobs:
3737
- name: Run Unit Tests
3838
run: ./ci unit_tests
3939

40-
# Publish SNAPSHOT after successful build and unit tests
41-
publish_snapshot_to_sonatype:
40+
publish_browser_switch_snapshot:
4241
needs: [ build_aar, unit_test_browser_switch ]
4342
name: Publish SNAPSHOT
4443
runs-on: ubuntu-latest
@@ -52,15 +51,15 @@ jobs:
5251
env:
5352
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
5453
- name: Publish SNAPSHOT to Sonatype
55-
run: ./ci publish_to_sonatype
54+
run: ./ci publish snapshot
5655
env:
5756
SONATYPE_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
5857
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
5958
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
6059
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
6160

6261
release_finished:
63-
needs: [ publish_snapshot_to_sonatype ]
62+
needs: [ publish_browser_switch_snapshot ]
6463
name: Release Finished
6564
runs-on: ubuntu-latest
6665
steps:

‎ci

+9-6
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,22 @@ case $command_name in
4242
increment_demo_app_version_code)
4343
./gradlew incrementVersionCode
4444
;;
45-
publish_to_sonatype)
45+
publish)
4646
# Ref: https://nickjanetakis.com/blog/prevent-unset-variables-in-your-shell-bash-scripts-with-set-nounset
4747
[ -n "${SONATYPE_USERNAME}" ] || (echo "::error:: SONATYPE_USERNAME env variable not set" && exit 1)
4848
[ -n "${SONATYPE_PASSWORD}" ] || (echo "::error:: SONATYPE_PASSWORD env variable not set" && exit 1)
4949
[ -n "${SIGNING_KEY_ID}" ] || (echo "::error:: SIGNING_KEY_ID env variable not set" && exit 1)
5050
[ -n "${SIGNING_KEY_PASSWORD}" ] || (echo "::error:: SIGNING_KEY_PASSWORD env variable not set" && exit 1)
5151
[ -n "${SIGNING_KEY_FILE}" ] || (echo "::error:: SIGNING_KEY_FILE env variable not set" && exit 1)
5252

53-
# publish to sonatype
54-
./gradlew clean :browser-switch:publishToSonatype
55-
;;
56-
close_and_release_repository)
57-
./gradlew --stacktrace closeAndReleaseSonatypeStagingRepository
53+
release_type="$2"
54+
if [ "${release_type}" == "release" ]; then
55+
# publish release
56+
./gradlew --stacktrace clean :browser-switch:publishToSonatype closeAndReleaseSonatypeStagingRepository
57+
else
58+
# publish SNAPSHOT
59+
./gradlew --stacktrace clean :browser-switch:publishToSonatype
60+
fi
5861
;;
5962
decode_signing_key)
6063
[ -n "${SIGNING_KEY}" ] || (echo "::error:: SIGNING_KEY env variable not set" && exit 1)

0 commit comments

Comments
 (0)
Please sign in to comment.