Add Android widgets #445
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: Build [Android] | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
types: [opened, synchronize, reopened, ready_for_review] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.draft == false && (github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, 'noci')) }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: cachix/install-nix-action@v27 | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- uses: nicknovitski/nix-develop@v1 | |
- name: Build debug APK | |
run: ./gradlew androidApp:packageDebug | |
- name: Build release APK | |
run: ./gradlew androidApp:packageRelease | |
- name: Upload universal debug APK artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: spmp-android-debug | |
path: androidApp/build/outputs/apk/debug/*.apk | |
- name: Upload universal release APK artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: spmp-android-release | |
path: androidApp/build/outputs/apk/release/*.apk | |
- name: Rename output files | |
run: | | |
mv androidApp/build/outputs/apk/release/*.apk androidApp/build/outputs/apk/release/spmp-nightly-android-universal.apk | |
mv androidApp/build/outputs/apk/debug/*.apk androidApp/build/outputs/apk/debug/spmp-nightly-android-universal-debug.apk | |
- name: Get current date and time | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S')" | |
- name: Update nightly release | |
uses: mini-bomba/create-github-release@v1.1.3 | |
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: nightly-latest | |
name: Nightly ${{ steps.date.outputs.date }} | |
files: | | |
androidApp/build/outputs/apk/release/spmp-nightly-android-universal.apk | |
androidApp/build/outputs/apk/debug/spmp-nightly-android-universal-debug.apk | |
clear_attachments: false | |
- name: Get short commit hash | |
run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Send completion notification to Discord webhook | |
uses: discord-actions/message@v2 | |
env: | |
BUILD_NOTIFICATION_DISCORD_WEBHOOK: ${{ secrets.BUILD_NOTIFICATION_DISCORD_WEBHOOK }} | |
if: env.BUILD_NOTIFICATION_DISCORD_WEBHOOK != null && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
with: | |
webhookUrl: ${{ secrets.BUILD_NOTIFICATION_DISCORD_WEBHOOK }} | |
message: "${{ github.workflow }} [build](<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>) completed for commit - [${{ env.COMMIT_SHA }}](<${{ github.event.head_commit.url }}>) ${{ github.event.head_commit.message }} - [Downloads](https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }})" |