Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
talosross authored Nov 25, 2023
1 parent e289029 commit a758b08
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,33 @@ jobs:
uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17

- name: Extract version info
id: extract-versions
run: |
VERSION_NAME=$(cat app/build.gradle | grep "versionName" | sed -En 's/.*"(.+)".*/\1/p')
VERSION_CODE=$(cat app/build.gradle | grep "versionCode" | awk '{print $2}')
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
set -e
VERSION_NAME=$(grep -E 'versionName\s' app/build.gradle | sed -n 's/.*"([^"]+)".*/\1/p')
VERSION_CODE=$(grep 'versionCode' app/build.gradle | awk '{print $2}')
echo "VERSION_NAME=${VERSION_NAME}" >> $GITHUB_ENV
echo "VERSION_CODE=${VERSION_CODE}" >> $GITHUB_ENV
- name: Build release APK
run: ./gradlew assembleRelease

- name: Rename artifact
run: mv "app/build/outputs/apk/release/app-release.apk" "SummaryYou-${{ env.VERSION_NAME }}-${{ env.VERSION_CODE }}.apk"

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Release APK
path: app/build/outputs/apk/release/SummaryYou-${{ env.VERSION_NAME }}-${{ env.VERSION_CODE }}.apk

publish-github-release:
runs-on: ubuntu-latest
needs: build-release-apk
Expand All @@ -39,15 +46,18 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: Release APK
path: artifacts/release-apk

- name: Set up environment variables
run: |
VERSION_NAME=${{ env.VERSION_NAME }}
VERSION_CODE=${{ env.VERSION_CODE }}
- name: Publish GitHub release
uses: softprops/action-gh-release@v1
with:
Expand Down

0 comments on commit a758b08

Please sign in to comment.