Skip to content

Feat/improve viper behavior parity dsp #7

Feat/improve viper behavior parity dsp

Feat/improve viper behavior parity dsp #7

Workflow file for this run

name: Build signed app
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- v*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
build:
name: Build app
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [Rootless, Root]
steps:
- id: flavor
uses: ASzc/change-string-case-action@v5
with:
string: ${{ matrix.flavor }}
- name: Install packages
run: |
sudo apt update
sudo apt install rename
- name: Clone repo
uses: actions/checkout@v4
with:
submodules: true
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
- name: Build release app
if: startsWith(github.ref, 'refs/tags/')
uses: gradle/gradle-command-action@v2
with:
arguments: assemble${{ matrix.flavor }}FullRelease
- name: Build preview app
if: "!startsWith(github.ref, 'refs/tags/')"
uses: gradle/gradle-command-action@v2
with:
arguments: assemble${{ matrix.flavor }}FullPreview
- name: Declare preview build type
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
set -x
echo "BUILD_TYPE=preview" >> $GITHUB_ENV
- name: Declare release build type
if: startsWith(github.ref, 'refs/tags/')
run: |
set -x
echo "BUILD_TYPE=release" >> $GITHUB_ENV
- name: Get tag name
if: startsWith(github.ref, 'refs/tags/')
run: |
set -x
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Sign APKs
uses: ilharp/sign-android-release@v1.0.4
with:
buildToolsVersion: 35.0.0
releaseDir: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}
signingKey: ${{ secrets.SIGNING_KEYSTORE }}
keyAlias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Rename build artifacts
run: |
set -e
ls -l app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}
rename -v 's/-unsigned-signed//g' app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*.apk
rm -f app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*unsigned*.apk || true
ls -l app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}
- name: Upload build artifact (universal)
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.flavor }}JamesDSP-universal-preview_apk"
path: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*universal-${{ env.BUILD_TYPE }}-signed.apk
- name: Upload build artifact (x86)
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.flavor }}JamesDSP-x86-preview_apk"
path: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*x86-${{ env.BUILD_TYPE }}-signed.apk
- name: Upload build artifact (x86_64)
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.flavor }}JamesDSP-x86_64-preview_apk"
path: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*x86_64-${{ env.BUILD_TYPE }}-signed.apk
- name: Upload build artifact (armeabi-v7a)
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.flavor }}JamesDSP-armeabi-v7a-preview_apk"
path: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*armeabi-v7a-${{ env.BUILD_TYPE }}-signed.apk
- name: Upload build artifact (arm64-v8a)
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.flavor }}JamesDSP-arm64-v8a-preview_apk"
path: app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*arm64-v8a-${{ env.BUILD_TYPE }}-signed.apk
- name: Deploy root flavor APKs to the server
if: ${{ steps.flavor.outputs.lowercase == 'root' && startsWith(github.ref, 'refs/tags/') && github.repository == 'timschneeb/RootlessJamesDSP' }}
uses: wlixcc/SFTP-Deploy-Action@v1.2.4
with:
username: 'tim'
server: 'srv1.timschneeberger.me'
ssh_private_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
local_path: "app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*universal-${{ env.BUILD_TYPE }}-signed.apk"
remote_path: '/srv/http/nightly.timschneeberger.me/jamesdsp-rootfull'
sftpArgs: '-o ConnectTimeout=5'
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION_TAG }}
name: RootlessJamesDSP ${{ env.VERSION_TAG }}
files: |
app/build/outputs/apk/${{ steps.flavor.outputs.lowercase }}Full/${{ env.BUILD_TYPE }}/*-signed.apk
overwrite_files: true
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
finalize_release_notes:
name: Finalize release notes
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure required CLI tools
run: |
set -euo pipefail
need_apt_update=0
if ! command -v gh >/dev/null 2>&1; then
need_apt_update=1
fi
if ! command -v jq >/dev/null 2>&1; then
need_apt_update=1
fi
if [ "$need_apt_update" -eq 1 ]; then
sudo apt-get update
fi
command -v gh >/dev/null 2>&1 || sudo apt-get install -y gh
command -v jq >/dev/null 2>&1 || sudo apt-get install -y jq
- name: Build downloads table from release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
TAG="${GITHUB_REF#refs/tags/}"
gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json assets > assets.json
{
echo "> Note: The root version is unmaintained and does not have feature parity with the rootless version."
echo
echo "## Downloads"
echo
echo "| Variant | Architecture | Download | Asset |"
echo "| --- | --- | --- | --- |"
for variant in rootless root; do
if [ "$variant" = "rootless" ]; then
variant_label="RootlessJamesDSP"
else
variant_label="JamesDSP (root)"
fi
for arch in universal arm64-v8a armeabi-v7a x86_64 x86; do
url="$(jq -r --arg variant "$variant" --arg arch "$arch" '.assets[] | select(.name | test("-" + $variant + "-full-" + $arch + "-release-signed\\.apk$")) | .url' assets.json | head -n 1)"
if [ -n "$url" ] && [ "$url" != "null" ]; then
asset_name="${url##*/}"
echo "| ${variant_label} | ${arch} | [Download](${url}) | \`${asset_name}\` |"
else
echo "| ${variant_label} | ${arch} | N/A | - |"
fi
done
done
} > release_downloads.md
- name: Build flat changelog from commits
run: |
set -euo pipefail
TAG="${GITHUB_REF#refs/tags/}"
PREV_TAG="$(git for-each-ref --sort=-creatordate --format='%(refname:short)' refs/tags | awk -v cur="$TAG" '$0 != cur { print; exit }')"
if [ -n "$PREV_TAG" ]; then
RANGE="${PREV_TAG}..${TAG}"
else
RANGE="$TAG"
fi
{
echo "## Changelog"
echo
if [ -n "$PREV_TAG" ]; then
echo "_Changes since ${PREV_TAG}_"
echo
fi
commit_count="$(git log --no-merges --oneline "$RANGE" | wc -l | tr -d '[:space:]')"
if [ "$commit_count" -eq 0 ]; then
echo "- No commit entries found."
else
git log --no-merges --pretty=format:'- %s ([`%h`](https://github.com/'"$GITHUB_REPOSITORY"'/commit/%H))' "$RANGE"
echo
fi
if [ -n "$PREV_TAG" ]; then
echo
echo "**Full Changelog**: https://github.com/${GITHUB_REPOSITORY}/compare/${PREV_TAG}...${TAG}"
fi
} > release_changelog.md
- name: Compose release notes
run: |
set -euo pipefail
cat release_downloads.md > release_notes.md
printf '\n' >> release_notes.md
cat release_changelog.md >> release_notes.md
- name: Update Release notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
TAG="${GITHUB_REF#refs/tags/}"
gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --notes-file release_notes.md