'Check if the artifacts are generated and exist in GitHub CI
- name: Build Debug APK
run: ./gradlew assembleDebug
- name: Get Debug APK
uses: actions/upload-artifact@v1
with:
name: app-debug
path: app/build/outputs/apk/debug/app-debug.apk
- name: Build Signed APK
run: ./gradlew assembleRelease
- name: Sign Android release
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Get Release APK
uses: actions/upload-artifact@v1
with:
name: app-release
path: ${{ env.SIGNED_RELEASE_FILE }}
- name: Check debug apk existence
id: check_debug
uses: andstor/file-existence-action@v1
with:
files: "app-debug.apk"
- name: Missing Debug APK
if: steps.check_debug.outputs.files_exists == 'false'
uses: dawidd6/action-send-mail@v2
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: Github Actions job result
body: Build job of ${{github.repository}} is incomplete, Debug APK missing!
to: ${{secrets.MAIL_USERNAME}}
from: ${{secrets.MAIL_USERNAME}}
- name: Contains Debug APK
if: steps.check_debug.outputs.files_exists == 'true'
uses: dawidd6/action-send-mail@v2
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: Github Actions job result
body: Build job of ${{github.repository}} completed successfully, Debug APK exists!
to: ${{secrets.MAIL_USERNAME}}
from: ${{secrets.MAIL_USERNAME}}
- name: Check release apk existence
id: check_release
uses: andstor/file-existence-action@v1
with:
files: "app-release.aab"
- name: Missing Release APK
if: steps.check_release.outputs.files_exists == 'false'
uses: dawidd6/action-send-mail@v2
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: Github Actions job result
body: Build job of ${{github.repository}} is incomplete, Release APK missing!
to: ${{secrets.MAIL_USERNAME}}
from: ${{secrets.MAIL_USERNAME}}
- name: Contains Release APK
if: steps.check_release.outputs.files_exists == 'true'
uses: dawidd6/action-send-mail@v2
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: Github Actions job result
body: Build job of ${{github.repository}} completed successfully, Release APK exists!
to: ${{secrets.MAIL_USERNAME}}
from: ${{secrets.MAIL_USERNAME}}
After generating the APK files for my Android repo, I want the GitHub CI to send me an email to notify me that the artifacts are generated. So here I have an action to check if the APK name exists and regardless of the result, send me an email.
These artifacts are generated successfully but I get the emails saying they don't exist.
What went wrong in my script?
Solution 1:[1]
You're using app/build/outputs/apk/debug/app-debug.apk
as an upload path but on the other hand you're checking app-debug.apk
for existence.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |