-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #282 from embrace-io/nelson/nexus-plugin
EMB-627 Added support for publishing, closing and releasing sonatype repositories
- Loading branch information
Showing
5 changed files
with
155 additions
and
98 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: Pre-Release for Smoke | ||
|
||
env: | ||
SONATYPE_USERNAME: embrace-io | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
MAVEN_QA_USER: github | ||
MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | ||
mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }} | ||
mavenSigningKeyRingFileEncoded: ${{ secrets.MAVEN_ANDROID_GPG_KEY }} | ||
mavenSigningKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }} | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
current_version: | ||
description: 'Version to release' | ||
required: true | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
jdk-version: ["11"] | ||
ndk-version: ["21.4.7075529"] | ||
steps: | ||
- name: Decode Keystore | ||
run: | | ||
mkdir "$RUNNER_TEMP"/keystore | ||
echo $mavenSigningKeyRingFileEncoded | base64 -di > "$RUNNER_TEMP"/keystore/2DE631C1.gpg | ||
echo "mavenSigningKeyRingFile=$RUNNER_TEMP/keystore/2DE631C1.gpg" >> $GITHUB_ENV | ||
- name: Checkout Branch | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.CD_GITHUB_TOKEN }} | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
~/.m2/repository | ||
~/.sonar/cache | ||
key: ${{ runner.os }}-gradle-jdk${{ matrix.jdk-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle | ||
- name: Install JDK ${{ matrix.jdk-version }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'adopt' | ||
java-version: ${{ matrix.jdk-version }} | ||
|
||
- name: Setup NDK ${{ matrix.ndk-version }} | ||
run: | | ||
export ANDROID_ROOT=/usr/local/lib/android | ||
export ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk | ||
export ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle | ||
ln -sfn $ANDROID_SDK_ROOT/ndk/${{ matrix.ndk-version }} $ANDROID_NDK_ROOT | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
|
||
# Build the entire project, run the tests, and run all static analysis | ||
- name: Gradle Build | ||
run: ./gradlew assembleRelease check --stacktrace | ||
|
||
- name: Archive Test Results | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: android-sdk-test-results | ||
path: embrace-android-sdk/build/reports/tests/ | ||
|
||
- name: Configure git | ||
run: | | ||
git config --global user.name 'embrace-ci[bot]' | ||
git config --global user.email '[email protected]' | ||
git config --global url."https://${{ secrets.CD_GITHUB_USER }}:${{ secrets.CD_GITHUB_TOKEN }}@github.com".insteadOf "https://github.com" | ||
- name: Gradlew Pre-Release | ||
run: | | ||
sed -i -r "s#version = ([^\']+)#version = ${{ github.event.inputs.current_version }}#" gradle.properties | ||
git add gradle.properties | ||
git commit -m "CI/CD: change version to be released: ${{ github.event.inputs.current_version }}" | ||
git push | ||
./gradlew clean publishReleasePublicationToSonatype closeSonatypeStagingRepository -Dorg.gradle.parallel=false --stacktrace | ||
- name: Checkout Swazzler | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: embrace-io/embrace-swazzler3 | ||
ref: master | ||
path: ./embrace-swazzler3 | ||
token: ${{ secrets.CD_GITHUB_TOKEN }} | ||
|
||
- name: Swazzler Release | ||
run: | | ||
cd ./embrace-swazzler3 | ||
./gradlew clean release -Dorg.gradle.parallel=false -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=${{ github.event.inputs.current_version }} -Prelease.newVersion=${{ github.event.inputs.next_version }}-SNAPSHOT --stacktrace | ||
- name: Cleanup Gradle Cache | ||
# Based on https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle#caching-dependencies | ||
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. | ||
# Restoring these files from a GitHub Actions cache might cause problems for future builds. | ||
run: | | ||
rm -f ~/.gradle/caches/modules-2/modules-2.lock | ||
rm -f ~/.gradle/caches/modules-2/gc.properties | ||
# measure-sdk-size: | ||
# uses: embrace-io/android-size-measure/.github/workflows/analyze-sdk-size.yml@main | ||
# needs: release | ||
# with: | ||
# sdk_version: ${{ github.event.inputs.current_version }} | ||
# token: ${{ secrets.CD_GITHUB_TOKEN }} | ||
# | ||
# measure-startup-time: | ||
# uses: embrace-io/android-sdk-benchmark/.github/workflows/macrobenchmark.yml@main | ||
# needs: release | ||
# with: | ||
# sdk_version: ${{ github.event.inputs.current_version }} | ||
# token: ${{ secrets.CD_GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,6 @@ env: | |
on: | ||
workflow_dispatch: | ||
inputs: | ||
current_version: | ||
description: 'Version to release' | ||
required: true | ||
next_version: | ||
description: 'Next Version (Do NOT include -SNAPSHOT, will be added automatically)' | ||
required: true | ||
|
@@ -27,69 +24,19 @@ jobs: | |
jdk-version: ["11"] | ||
ndk-version: ["21.4.7075529"] | ||
steps: | ||
- name: Decode Keystore | ||
run: | | ||
mkdir "$RUNNER_TEMP"/keystore | ||
echo $mavenSigningKeyRingFileEncoded | base64 -di > "$RUNNER_TEMP"/keystore/2DE631C1.gpg | ||
echo "mavenSigningKeyRingFile=$RUNNER_TEMP/keystore/2DE631C1.gpg" >> $GITHUB_ENV | ||
- name: Checkout Branch | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.CD_GITHUB_TOKEN }} | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
~/.m2/repository | ||
~/.sonar/cache | ||
key: ${{ runner.os }}-gradle-jdk${{ matrix.jdk-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle | ||
- name: Install JDK ${{ matrix.jdk-version }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'adopt' | ||
java-version: ${{ matrix.jdk-version }} | ||
|
||
- name: Setup NDK ${{ matrix.ndk-version }} | ||
- name: Gradlew Release | ||
run: | | ||
export ANDROID_ROOT=/usr/local/lib/android | ||
export ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk | ||
export ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle | ||
ln -sfn $ANDROID_SDK_ROOT/ndk/${{ matrix.ndk-version }} $ANDROID_NDK_ROOT | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository -Dorg.gradle.parallel=false --stacktrace | ||
# TODO: check if swazzler gets released too | ||
|
||
# Build the entire project, run the tests, and run all static analysis | ||
- name: Gradle Build | ||
run: ./gradlew assembleRelease check --stacktrace | ||
|
||
- name: Archive Test Results | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: android-sdk-test-results | ||
path: embrace-android-sdk/build/reports/tests/ | ||
- name: Generate Documentation | ||
run: ./gradlew dokkaHtml | ||
|
||
- name: Gradlew Release | ||
- name: Configure git | ||
run: | | ||
git config --global user.name 'embrace-ci[bot]' | ||
git config --global user.email '[email protected]' | ||
git config --global url."https://${{ secrets.CD_GITHUB_USER }}:${{ secrets.CD_GITHUB_TOKEN }}@github.com".insteadOf "https://github.com" | ||
sed -i -r "s#version = ([^\']+)#version = ${{ github.event.inputs.current_version }}#" gradle.properties | ||
git add gradle.properties | ||
git commit -m "CI/CD: change version to be released: ${{ github.event.inputs.current_version }}" | ||
git push | ||
./gradlew clean publishReleasePublicationToSonatypeRepository -Dorg.gradle.parallel=false --stacktrace | ||
- name: Generate Documentation | ||
run: ./gradlew dokkaHtml | ||
- name: Publish gh-pages | ||
run: | | ||
|
@@ -118,37 +65,10 @@ jobs: | |
git commit -m "CI/CD: set next version: ${{ github.event.inputs.next_version }}" | ||
git push | ||
- name: Checkout Swazzler | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: embrace-io/embrace-swazzler3 | ||
ref: master | ||
path: ./embrace-swazzler3 | ||
token: ${{ secrets.CD_GITHUB_TOKEN }} | ||
|
||
- name: Swazzler Release | ||
run: | | ||
cd ./embrace-swazzler3 | ||
./gradlew clean release -Dorg.gradle.parallel=false -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=${{ github.event.inputs.current_version }} -Prelease.newVersion=${{ github.event.inputs.next_version }}-SNAPSHOT --stacktrace | ||
- name: Cleanup Gradle Cache | ||
# Based on https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle#caching-dependencies | ||
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. | ||
# Restoring these files from a GitHub Actions cache might cause problems for future builds. | ||
run: | | ||
rm -f ~/.gradle/caches/modules-2/modules-2.lock | ||
rm -f ~/.gradle/caches/modules-2/gc.properties | ||
# measure-sdk-size: | ||
# uses: embrace-io/android-size-measure/.github/workflows/analyze-sdk-size.yml@main | ||
# needs: release | ||
# with: | ||
# sdk_version: ${{ github.event.inputs.current_version }} | ||
# token: ${{ secrets.CD_GITHUB_TOKEN }} | ||
# | ||
# measure-startup-time: | ||
# uses: embrace-io/android-sdk-benchmark/.github/workflows/macrobenchmark.yml@main | ||
# needs: release | ||
# with: | ||
# sdk_version: ${{ github.event.inputs.current_version }} | ||
# token: ${{ secrets.CD_GITHUB_TOKEN }} | ||
rm -f ~/.gradle/caches/modules-2/gc.properties |
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
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
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