Publish Artifacts #45
Workflow file for this run
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: Publish Artifacts | |
on: | |
workflow_dispatch: # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch | |
inputs: | |
version: | |
description: 'Build for version' | |
type: string | |
required: true | |
release: | |
types: [ published ] # https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release | |
env: | |
VERSION: ${{ github.event.release.tag_name || inputs.version }} | |
BUNDLE_RELEASE_FILENAME: zvernam-${{ github.event.release.tag_name || inputs.version }}.aab | |
BUNDLE_FILE_PATH: app/build/outputs/bundle/release # Aka AAB file | |
APK_RELEASE_FILENAME: zvernam-${{ github.event.release.tag_name || inputs.version }}.apk | |
APK_FILE_PATH: app/build/outputs/apk/release | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: gradle | |
- name: Print All Env Vars | |
run: env | |
- name: Echo current actor | |
run: echo 'Current user is:' $GITHUB_ACTOR | |
- name: Print current version | |
run: echo 'Current version:' ${{ env.VERSION }} | |
- name: Get build-tools version | |
run: ls /usr/local/lib/android/sdk/build-tools/ | |
- name: Assemble Release with Gradle | |
run: ./gradlew assembleRelease bundleRelease | |
env: | |
USERNAME: ${{ env.GITHUB_ACTOR }} | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PROJECT_VERSION: ${{ env.VERSION }} | |
- name: List output files | |
run: find app/build/outputs -type f | |
- name: Move Unsigned File | |
run: | | |
mv ${{ env.BUNDLE_FILE_PATH }}/*.aab app/build/${{ env.BUNDLE_RELEASE_FILENAME }} | |
mv ${{ env.APK_FILE_PATH }}/*.apk app/build/${{ env.APK_RELEASE_FILENAME }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unsigned | |
path: | | |
app/build/${{ env.BUNDLE_RELEASE_FILENAME }} | |
app/build/${{ env.APK_RELEASE_FILENAME }} | |
if-no-files-found: error | |
sign: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Unsigned Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: unsigned | |
- name: Show Downloaded Files | |
run: ls -lah | |
- name: Sign Files | |
uses: r0adkll/sign-android-release@v1 | |
id: sign | |
with: | |
releaseDirectory: . | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: "34.0.0" | |
- name: Show signed files | |
run: | | |
ls -lah | |
echo ${{ steps.sign.outputs.signedReleaseFiles }} | |
- name: Rename Signed APK File | |
run: mv ${{ steps.sign.signedReleaseFile1 }} ./${{ env.APK_RELEASE_FILENAME }} | |
- name: Upload Signed artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: signed | |
path: | | |
./${{ env.BUNDLE_RELEASE_FILENAME }} | |
./${{ env.APK_RELEASE_FILENAME }} | |
if-no-files-found: error | |
release: | |
needs: sign | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Signed Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: signed | |
- name: Show Downloaded Files | |
run: ls -lah | |
- name: Create release ${{ env.VERSION }} draft | |
if: false | |
uses: svenstaro/upload-release-action@v2 #https://github.com/marketplace/actions/upload-files-to-a-github-release | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.BUNDLE_RELEASE_FILENAME }} | |
asset_name: zvernam-${{ env.VERSION }}.aab | |
tag: ${{ github.ref }} | |
draft: true | |
overwrite: true | |
body: "Release ${{ env.VERSION }}" |