Update gradle-publish.yml #4
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: Build APK and Notify Discord | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-notify: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Android SDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
- name: Grant execute permissions to gradlew | |
run: chmod +x gradlew | |
- name: Build APK | |
run: ./gradlew assembleRelease | |
- name: Get latest commit message and ID | |
id: get_commit_info | |
run: | | |
echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)" >> $GITHUB_ENV | |
echo "COMMIT_ID=${GITHUB_SHA}" >> $GITHUB_ENV | |
- name: Send Discord notification | |
uses: dawidd6/action-discord@v2 | |
with: | |
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
username: "Pre-Build Builder" | |
avatar_url: "https://media.discordapp.net/attachments/1066717089118814258/1183076684770054248/Xt6r8d0v.png?ex=65870506&is=65749006&hm=ce4090a900734cc623540a0a63a0f01844c9d54a0b33683fccb8587d408ca73b&" | |
content: | | |
**New APK build available!** | |
* **Commit ID:** ${{ steps.get_commit_info.outputs.COMMIT_ID }} | |
* **Commit message:** ${{ steps.get_commit_info.outputs.COMMIT_MESSAGE }} | |
* **Download:** https://github.com/${{ github.repository }}/releases/latest/download/app-release.apk | |