v2.4.1 #18
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: Publish | |
on: | |
release: | |
types: | |
- released | |
jobs: | |
library: | |
name: Release build and publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: adopt | |
java-version: 17 | |
# Base64 decodes and pipes the GPG key content into the secret file | |
- name: Prepare environment | |
env: | |
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }} | |
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | |
run: | | |
git fetch --unshallow | |
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'" | |
# Builds the release artifacts of the library | |
- name: Release build | |
run: ./gradlew clean :library:assembleRelease --full-stacktrace | |
# Generates other artifacts (javadocJar is optional) | |
- name: Source jar | |
run: ./gradlew androidSourcesJar sourcesJar javadocJar | |
# Runs upload, and then closes & releases the repository | |
- name: Publish to MavenCentral | |
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseStagingRepository | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | |
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | |
apk: | |
name: Build apk, upload to release and notify Discord | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Delete some caches | |
run: rm -f ~/.gradle/caches/modules-2/modules-2.lock; rm -fr ~/.gradle/caches/*/plugin-resolution/ | |
- name: Cache Gradle | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.android/build-cache | |
~/.m2 | |
~/.gradle | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Delete previous outputs | |
run: rm -rf $TRAVIS_BUILD_DIR/app/build/outputs | |
- name: Make gradlew executable | |
run: chmod +x gradlew; chmod +x gradle/wrapper/gradle-wrapper.jar | |
- name: Build master app | |
run: ./gradlew clean :app:assembleRelease --full-stacktrace | |
- name: Get release information | |
env: | |
GITHUB_API_KEY: ${{ secrets.GITHUB_TOKEN }} | |
run: chmod +x ./scripts/get_release_data.sh; ./scripts/get_release_data.sh | |
- name: Upload APK to release | |
id: upload_apk | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "./app/build/outputs/apk/release/${{ env.apk_file }}" | |
asset_name: "Blueprint-${{ env.release_tag }}.apk" | |
tag: ${{ env.release_tag }} | |
overwrite: true | |
- name: Notify Discord server | |
env: | |
RELEASE_TAG: ${{ env.release_tag }} | |
APK_URL: ${{ steps.upload_apk.outputs.browser_download_url }} | |
CHANGELOG: ${{ env.release_changes }} | |
UPDATE_DISCORD_WEBHOOK: ${{ secrets.UPDATE_DISCORD_WEBHOOK }} | |
run: chmod +x ./scripts/notify_discord.sh; ./scripts/notify_discord.sh |