Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions .github/workflows/android-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version tag to create and release (e.g. v0.1.0)'
required: true

permissions:
contents: write
Expand All @@ -19,6 +24,28 @@ jobs:
with:
fetch-depth: 0

- name: Resolve release version
id: version
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "value=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
else
echo "value=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi

- name: Create and push release tag
if: github.event_name == 'workflow_dispatch'
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.value }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "$VERSION"
git push origin "$VERSION"

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -52,24 +79,27 @@ jobs:
run: ./gradlew :app:assembleRelease --stacktrace

- name: Prepare release APK
env:
VERSION: ${{ steps.version.outputs.value }}
run: |
set -euo pipefail
mkdir -p dist
APK_PATH="$(find app/build/outputs/apk/release -name '*.apk' | head -n 1)"
cp "$APK_PATH" "dist/Sploot-${GITHUB_REF_NAME}.apk"
cp "$APK_PATH" "dist/Sploot-${VERSION}.apk"

- name: Upload release APK artifact
uses: actions/upload-artifact@v4
with:
name: Sploot-release-apk
path: dist/Sploot-${{ github.ref_name }}.apk
path: dist/Sploot-${{ steps.version.outputs.value }}.apk
if-no-files-found: error

- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.value }}
run: |
set -euo pipefail
gh release create "${GITHUB_REF_NAME}" "dist/Sploot-${GITHUB_REF_NAME}.apk" \
--title "Sploot ${GITHUB_REF_NAME}" \
gh release create "$VERSION" "dist/Sploot-${VERSION}.apk" \
--title "Sploot $VERSION" \
--generate-notes
Loading