Deploy: Merge final release v1.06 build 1 (#8) #9
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: 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 Build File 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 | |
lib-build: | |
needs: lib-version | |
name: LIB Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: ${{ runner.os }}-maven- | |
- 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: List Download LIB Version Artifacts | |
run: ls -l lib-version-artifacts | |
- name: Read Release Tag File | |
run: echo "RELEASE_TAG=$(cat lib-version-artifacts/release_tag.txt)" >> $GITHUB_ENV | |
- name: Build LIB files | |
run: ./gradlew publishMavenPublicationToMavenLocal | |
env: | |
PGP_KEY_ID: ${{ secrets.PGP_KEY_ID }} | |
PGP_PRIVATE_KEY: ${{ secrets.PGP_PRIVATE_KEY }} | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
- name: Create LIB Build Artifacts Temp Folder | |
run: mkdir -p lib-build-temp | |
- name: Move LIB Build Files to lib-build-temp | |
run: cp ~/.m2/repository/com/fappslab/tourtip/tourtip/${{ env.RELEASE_TAG }}/* lib-build-temp/ | |
- name: List LIB Build Artifacts Temp Folder | |
run: ls -l lib-build-temp | |
- name: Create LIB Build Artifacts Folder | |
run: mkdir -p lib-build-artifacts | |
- name: Compress LIB Build Artifacts | |
run: | | |
cd lib-build-temp | |
zip -r lib-build-artifacts.zip . | |
mv lib-build-artifacts.zip ../lib-build-artifacts | |
shell: bash | |
- name: Upload LIB Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
retention-days: 1 | |
name: lib-build | |
path: lib-build-artifacts | |
create-release: | |
needs: [apk-build, lib-build] | |
name: Create Release | |
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 LIB Build Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: lib-build | |
path: lib-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 LIB Build Artifacts | |
run: ls -l lib-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 LIB Release Assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: lib-build-artifacts/lib-build-artifacts.zip | |
asset_name: tourtip-v${{ env.RELEASE_TAG }}.zip | |
asset_content_type: application/zip | |
- name: Delete Release Artifacts | |
run: | | |
rm -rf lib-version-artifacts | |
rm -rf apk-build-artifacts | |
rm -rf lib-build-artifacts | |
rm -f FINAL_RELEASE_NOTES.md | |
rm -f TEMP_RELEASE_NOTES.md |