Skip to content

Instantly share code, notes, and snippets.

@hkusu
Created August 31, 2021 15:03
Show Gist options
  • Save hkusu/efc426118a42e85676e3125653201cd1 to your computer and use it in GitHub Desktop.
Save hkusu/efc426118a42e85676e3125653201cd1 to your computer and use it in GitHub Desktop.
name: Build
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- name: Check out
uses: actions/checkout@v2
with:
ref: ${{ github.sha }}
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 11
cache: 'gradle'
- name: Build with Gradle
run: ./gradlew assembleDebug
- name: Get apk path
id: apk-path
run: echo "::set-output name=path::$(find **/build/outputs/apk -name '*.apk' -type f | head -1)"
- name: Upload apk file to S3
id: upload
uses: hkusu/s3-upload-action@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: 'ap-northeast-1'
aws-bucket: ${{ secrets.AWS_BUCKET }}
file-path: ${{ steps.apk-path.outputs.path }}
output-file-url: 'true'
content-type: 'application/vnd.android.package-archive'
output-qr-url: 'true'
- name: Get apk info
id: apk-info
uses: hkusu/apk-info-action@v1
with:
apk-path: ${{ steps.apk-path.outputs.path }}
- name: Notify
uses: hkusu/slack-post-action@v1
env:
SLACK_APP_TOKEN: ${{ secrets.SLACK_TOKEN }}
with:
channel: 'your_report_channel'
message: '*Build Succeeded!*'
color: 'good'
report-sha: ${{ github.sha }}
log-button: 'View log'
fields: |
[
{
"title": "app name",
"value": "${{ steps.apk-info.outputs.application-name }}",
"short": true
},
{
"title": "application ID",
"value": "${{ steps.apk-info.outputs.application-id }}",
"short": true
},
{
"title": "build variant",
"value": "Debug",
"short": true
},
{
"title": "version name (version code)",
"value": "${{ steps.apk-info.outputs.version-name }} (${{ steps.apk-info.outputs.version-code }})",
"short": true
},
{
"title": "min SDK version",
"value": "${{ steps.apk-info.outputs.min-sdk-version }}",
"short": true
},
{
"title": "target SDK version (compile SDK version)",
"value": "${{ steps.apk-info.outputs.target-sdk-version }} (${{ steps.apk-info.outputs.compile-sdk-version }})",
"short": true
},
{
"title": "apk file size",
"value": "${{ steps.apk-info.outputs.readable-file-size }}",
"short": true
}
]
image: ${{ steps.upload.outputs.qr-url }}
actions: |
[
{
"type": "button",
"text": "Download apk",
"url": "${{ steps.upload.outputs.file-url }}"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment