Skip to content

Deploy: Merge final release v1.06 build 1 (#5) #6

Deploy: Merge final release v1.06 build 1 (#5)

Deploy: Merge final release v1.06 build 1 (#5) #6

Workflow file for this run

name: Release Build
on:
push:
branches:
- master
jobs:
check-actor:
name: Check Actor
runs-on: ubuntu-latest
steps:
- name: Check Authorized User
run: |
if [[ "${{ github.actor }}" != "F4bioo" ]]; then
echo "Unauthorized user. Exiting."
exit 1
fi
check_job_flag:
name: Check Job Flag
runs-on: ubuntu-latest
steps:
- name: Should Create Release
run: |
echo "Current Job Flag value is: ${{ vars.SHOULD_CREATE_RELEASE }}"
lib-version:
needs: [check-actor, check_job_flag]
if: ${{ vars.SHOULD_CREATE_RELEASE == 'true' }}
name: LIB Version
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Read Config File
id: version_details
run: |
echo "VERSION_NAME=$(grep 'const val versionName' buildSrc/src/main/java/Config.kt | awk -F '=' '{print $2}' | tr -d ' \"')" >> $GITHUB_ENV
echo "VERSION_CODE=$(grep 'const val versionCode' buildSrc/src/main/java/Config.kt | awk -F '=' '{print $2}' | tr -d ' ')" >> $GITHUB_ENV
- name: Create Release Tag
run: echo "RELEASE_TAG=${{ env.VERSION_NAME }}.${{ env.VERSION_CODE }}" >> $GITHUB_ENV
- name: Create LIB Version Artifacts Folder
run: mkdir -p lib-version-artifacts
- name: Create Release Tag File
run: echo "${{ env.RELEASE_TAG }}" > $GITHUB_WORKSPACE/lib-version-artifacts/release_tag.txt
- name: List Upload LIB Version Artifacts
run: ls -l lib-version-artifacts
- name: Upload LIB Version Artifacts
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: lib-version
path: lib-version-artifacts
apk-build:
needs: lib-version
name: APK Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Grant Gradlew Permission
run: chmod +x gradlew
- name: Build APK Sample
run: ./gradlew assembleRelease
- name: Create APK Build Artifacts Folder
run: mkdir -p apk-build-artifacts
- name: Move APK Builds Files to apk-build-artifacts
run: mv app/build/outputs/apk/release/app-release-unsigned.apk apk-build-artifacts/app-release-unsigned.apk
- name: List Upload APK Build Artifacts
run: ls -l apk-build-artifacts
- name: Upload APK Build Artifacts
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: apk-build
path: apk-build-artifacts
aar-build:
needs: lib-version
name: AAR Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Grant Gradlew Permission
run: chmod +x gradlew
- name: Build AAR Library
run: ./gradlew publishReleasePublicationToMavenLocal
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
PGP_PRIVATE_KEY: ${{ secrets.PGP_PRIVATE_KEY }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
- name: Create AAR Build Artifacts Folder
run: mkdir -p aar-build-artifacts
- name: Move AAR Builds Files to aar-build-artifacts
run: mv tourtip/build/outputs/aar/tourtip-release.aar aar-build-artifacts/tourtip-release.aar
- name: List Upload AAR Build Artifacts
run: ls -l aar-build-artifacts
- name: Upload AAR Build Artifacts
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: aar-build
path: aar-build-artifacts
sign-pgp:
needs: aar-build
name: Sign PGP
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download AAR Build Artifacts
uses: actions/download-artifact@v3
with:
name: aar-build
path: aar-build-artifacts
- name: List Download AAR Build Artifacts
run: ls -l aar-build-artifacts
- name: Import PGP Key
run: echo "${{ secrets.PGP_PRIVATE_KEY }}" | gpg --batch --import
- name: Sign AAR with PGP
run: echo "${{ secrets.PGP_PASSPHRASE }}" | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --armor --detach-sign aar-build-artifacts/tourtip-release.aar
- name: List PGP Sign AAR Build Artifacts
run: ls -l aar-build-artifacts
- name: Upload PGP Sign Build Artifacts
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: sign-pgp
path: aar-build-artifacts
lib-deploy:
needs: sign-pgp
name: App Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Grant Gradlew Permission
run: chmod +x gradlew
- name: Download LIB Version Artifacts
uses: actions/download-artifact@v3
with:
name: lib-version
path: lib-version-artifacts
- name: Download APK Build Artifacts
uses: actions/download-artifact@v3
with:
name: apk-build
path: apk-build-artifacts
- name: Download AAR Build Artifacts
uses: actions/download-artifact@v3
with:
name: sign-pgp
path: aar-build-artifacts
- name: List Download LIB Version Artifacts
run: ls -l lib-version-artifacts
- name: List Download APK Build Artifacts
run: ls -l apk-build-artifacts
- name: List Download AAR Build Artifacts
run: ls -l aar-build-artifacts
- name: Read Release Tag File
run: echo "RELEASE_TAG=$(cat lib-version-artifacts/release_tag.txt)" >> $GITHUB_ENV
- name: Create Release Notes
run: |
set -e
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null) || true
IGNORED_SUFFIXES=$(awk 'NF && $0 !~ /^ *$/ { $1=$1; print }' .github/markdown/release-build-ignore-suffixes.md | awk 'BEGIN { ORS = "|" } { print }' | sed 's/|$//')
if [ -z "$LAST_TAG" ]; then
RELEASE_NOTES="- Initial Release: We're Live! 🎈"
else
git log ${LAST_TAG}..HEAD --pretty=format:"- %s %b" --abbrev-commit | grep -v -E "^- (${IGNORED_SUFFIXES}):" > TEMP_RELEASE_NOTES.md
RELEASE_NOTES=$(cat TEMP_RELEASE_NOTES.md)
fi
export RELEASE_NOTES
envsubst < .github/markdown/release-build-message.md > FINAL_RELEASE_NOTES.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.RELEASE_TAG }}
release_name: v${{ env.RELEASE_TAG }}
body_path: FINAL_RELEASE_NOTES.md
draft: false
prerelease: false
- name: Upload APK Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: apk-build-artifacts/app-release-unsigned.apk
asset_name: tourtip-sample-v${{ env.RELEASE_TAG }}-unsigned.apk
asset_content_type: application/vnd.android.package-archive
- name: Upload AAR Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: aar-build-artifacts/tourtip-release.aar
asset_name: tourtip-v${{ env.RELEASE_TAG }}.aar
asset_content_type: application/java-archive
- name: Upload PGP Signature Release Asset for AAR
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: aar-build-artifacts/tourtip-release.aar.asc
asset_name: tourtip-v${{ env.RELEASE_TAG }}.aar.asc
asset_content_type: application/pgp-signature
- name: Publish Library to Maven Central
run: ./gradlew publishReleasePublicationToSonatypeRepository
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
PGP_PRIVATE_KEY: ${{ secrets.PGP_PRIVATE_KEY }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}