Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Fix the internal_release.yml automation #91

Fix the internal_release.yml automation

Fix the internal_release.yml automation #91

name: Internal Release
on:
push:
tags:
- 'v*'
jobs:
internal_release:
runs-on: ubuntu-latest
outputs:
github_release_url: ${{ steps.create_release.outputs.github_release_url }}
steps:
- name: Checkout GIT
uses: actions/checkout@v4
with:
fetch-depth: 0 #Fetch all history for all branches and tags
- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '18'
- name: Setup Ruby (for Fastlane)
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- name: Install Fastlane
run: bundle install
#----------------------------------------------------
#Security
- name: Validate Gradle Wrapper checksum
uses: gradle/wrapper-validation-action@v3
- name: Make Gradle Wrapper (gradlew) executable
run: chmod +x gradlew
#----------------------------------------------------
#Optimization
- name: Enable Gradle Wrapper caching (optimization)
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
#---------------------------------------------------
#Decode Secrets for production build
- name: Create JKS for prod signing
run: |
echo "$SIGNING_KEYSTORE_JKS" > sign.jks.b64
base64 -d -i sign.jks.b64 > sign.jks
env:
SIGNING_KEYSTORE_JKS: ${{ secrets.SIGNING_KEYSTORE }}
- name: Create Google Play Config file
run: |
echo "$PLAY_CONFIG_JSON" > play_config.json.b64
base64 -d -i play_config.json.b64 > google-play-console-user.json
env:
PLAY_CONFIG_JSON: ${{ secrets.GOOGLE_PLAY_CONSOLE_JSON }}
#--------------------------------------------------------------------------------
- name: Verify that the code is release-able ("lintRelease")
run: ./gradlew lintRelease
- name: Upload Lint Release report to GitHub
uses: actions/upload-artifact@v4
with:
name: lint-release-report.html
path: app/build/reports/lint-results-release.html
#Fastlane: Build production .aab and release it to Internal Testing
- name: Build production App Bundle
run: bundle exec fastlane production_build
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
- name: Upload App Bundle to GitHub
uses: actions/upload-artifact@v4
with:
name: app-release.aab
path: app/build/outputs/bundle/release/app-release.aab
- name: Release App Bundle to Internal Testing
run: bundle exec fastlane internal_release
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
#--------------------------------------------------------------------------
#Create GitHub release
# Bullrich/generate-release-changelog@master doesn't run on macos-latest
- name: Prepare changelog for GitHub Release
uses: Bullrich/generate-release-changelog@master
id: Changelog
env:
REPO: ${{ github.repository }}
- name: Create GitHub Release
if: always() #Execute even the generation of changelog has failed
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
${{ steps.Changelog.outputs.changelog }}
draft: false
prerelease: false
run: echo "github_release_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_ENV
build_demo_apk_and_announce:
runs-on: ubuntu-latest
needs: internal_release
steps:
- name: Checkout GIT
uses: actions/checkout@v4
- name: Setup Java SDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '18'
- name: Make Gradle Wrapper (gradlew) executable
run: chmod +x gradlew
- name: Enable Gradle Wrapper caching (optimization)
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build Demo APK
run: ./gradlew assembleDemo
- name: Upload APK to Github Actions
uses: actions/upload-artifact@v4
with:
name: Ivy-Wallet-Demo.apk
path: app/build/outputs/apk/demo/app-demo.apk
- name: Upload Demo APK to GitHub Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.internal_release.outputs.github_release_url }}
asset_path: app/build/outputs/apk/demo/app-demo.apk
asset_name: Ivy-Wallet-Demo.apk
asset_content_type: application/vnd.android.package-archive
- name: Announce in Telegram group
if: |
github.ref == 'refs/heads/main'
run: |
COMMIT_LINK="https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
RELEASE_TAG=$(echo ${GITHUB_REF} | sed 's/refs\/tags\///')
CAPTION=$'🔥 Ivy Wallet '"$RELEASE_TAG"$' release from commit at: '"$COMMIT_LINK"
curl -F "chat_id=-1001647280565" \
-F "document=@app/build/outputs/apk/demo/app-demo.apk" \
-F "reply_to_message_id=16118" \
-F "caption=$CAPTION" \
https://api.telegram.org/bot${{ secrets.BOTFATHER_TELEGRAM_BOT_TOKEN }}/sendDocument