Skip to content

Commit

Permalink
Fix the internal_release.yml (#3290)
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Jul 7, 2024
1 parent c6dc410 commit 7f25648
Showing 1 changed file with 43 additions and 63 deletions.
106 changes: 43 additions & 63 deletions .github/workflows/internal_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ on:
- main

jobs:
internal_release:
google_play_release:
if: |
contains(github.event.head_commit.message, 'Automatic release')
permissions:
contents: write
outputs:
github_release_url: ${{ steps.share_release_url_output.outputs.github_release_url }}
runs-on: ubuntu-latest

steps:
Expand All @@ -36,14 +32,6 @@ jobs:
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
Expand Down Expand Up @@ -72,24 +60,6 @@ jobs:
PLAY_CONFIG_JSON: ${{ secrets.GOOGLE_PLAY_CONSOLE_JSON }}
#--------------------------------------------------------------------------------

- name: Get version name and code from libs.versions.toml
id: get_version
run: |
VERSION_NAME=$(grep 'version-name =' gradle/libs.versions.toml | awk -F'=' '{print $2}' | tr -d ' "')
VERSION_CODE=$(grep 'version-code =' gradle/libs.versions.toml | awk -F'=' '{print $2}' | tr -d ' "')
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
- name: Create and push tag
env:
PAT_TOKEN: ${{ secrets.IVYWALLET_BOT_GITHUB_PAT_2 }}
run: |
TAG_NAME="v${{ env.VERSION_NAME }}-${{ env.VERSION_CODE }}"
git tag $TAG_NAME
git push https://x-access-token:${{ env.PAT_TOKEN }}@github.com/${{ github.repository }} $TAG_NAME
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
# Fastlane: Build production .aab and release it to Internal Testing
- name: Build production App Bundle
run: bundle exec fastlane production_build
env:
Expand All @@ -109,35 +79,13 @@ jobs:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
#--------------------------------------------------------------------------

- 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 if the generation of changelog has failed
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: Release ${{ env.TAG_NAME }}
body: |
${{ steps.Changelog.outputs.changelog }}
draft: false
prerelease: false

- name: Share GitHub Release URL as output
id: share_release_url_output
run: echo "github_release_url=steps.create_release.outputs.upload_url" >> "$GITHUB_OUTPUT"

upload_apk_and_announce:
github_release:
if: |
contains(github.event.head_commit.message, 'Automatic release')
runs-on: ubuntu-latest
needs: internal_release
permissions:
contents: write

steps:
- name: Checkout GIT
Expand All @@ -149,9 +97,6 @@ jobs:
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:
Expand All @@ -162,6 +107,21 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Get version name and code from libs.versions.toml
id: get_version
run: |
VERSION_NAME=$(grep 'version-name =' gradle/libs.versions.toml | awk -F'=' '{print $2}' | tr -d ' "')
VERSION_CODE=$(grep 'version-code =' gradle/libs.versions.toml | awk -F'=' '{print $2}' | tr -d ' "')
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
- name: Create and push tag
run: |
TAG_NAME="v${{ env.VERSION_NAME }}-${{ env.VERSION_CODE }}"
git tag $TAG_NAME
git push origin $TAG_NAME
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
- name: Build Demo APK
run: ./gradlew assembleDemo

Expand All @@ -171,10 +131,30 @@ jobs:
name: Ivy-Wallet-Demo.apk
path: app/build/outputs/apk/demo/app-demo.apk

- name: Upload Demo APK to GitHub Release
- name: Prepare changelog for GitHub Release
id: changelog
continue-on-error: true
uses: Bullrich/generate-release-changelog@master
env:
REPO: ${{ github.repository }}

- name: Create GitHub Release
id: create_github_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: Release ${{ env.TAG_NAME }}
body: |
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false

- name: Upload APK to GitHub Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.internal_release.outputs.github_release_url }}
upload_url: ${{ steps.create_github_release.outputs.upload_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
Expand Down

1 comment on commit 7f25648

@ILIYANGERMANOV
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the constructive career advice! That honestly made my day 😄

Please sign in to comment.