2024-04-19 15:49:30 -06:00
name : Release
on :
workflow_dispatch :
2024-04-21 14:40:09 -06:00
inputs :
title :
type : string
description : 'Title'
required : true
default : 'v0.00.0 R0'
2024-12-06 16:43:00 +03:00
# pre-release is default anymore !
# is_pre_release:
# type: boolean
# description: 'Set as a pre-release'
# required: true
# default: true
style :
type : integer
description: '1: master only, 2: extended only, 3: both master&extended, 4 : only selected branch'
2024-04-21 14:40:09 -06:00
required : true
2024-12-06 16:43:00 +03:00
default : 3
2024-04-19 15:49:30 -06:00
jobs :
2024-04-21 14:40:09 -06:00
build-and-release :
2024-04-19 15:49:30 -06:00
runs-on : ubuntu-latest
2024-12-02 18:40:33 +03:00
2024-04-20 10:12:58 -06:00
permissions : write-all
2024-04-19 15:49:30 -06:00
steps :
2024-12-06 16:43:00 +03:00
- name : Create proper environment for multiple apk output
2024-04-20 10:12:58 -06:00
run : |
2024-12-06 16:43:00 +03:00
mkdir -p "${{ github.workspace }}/output"
if [[ "${{ inputs.style }}" -eq "1" ]]; then
mkdir -p "${{ github.workspace }}/master"
elif [[ "${{ inputs.style }}" -eq "2" ]]; then
mkdir -p "${{ github.workspace }}/extended"
elif [[ "${{ inputs.style }}" -eq "3" ]]; then
# mkdir -p "${{ github.workspace }}/{master,extended}" # REVIEW not working, why?
mkdir -p "${{ github.workspace }}/master"
mkdir -p "${{ github.workspace }}/extended"
else
mkdir -p "${{ github.workspace }}/current"
fi
ls -la
- name : Checkout all selected branches
env :
BRANCH : ${{ github.ref_name }}
run : |
if [[ "${{ inputs.style }}" -eq "1" ]]; then
cd "${{ github.workspace }}/master"
git clone --no-checkout https://github.com/MaintainTeam/LastPipeBender.git .
git config core.symlinks false
git checkout --progress --force "master"
elif [[ "${{ inputs.style }}" -eq "2" ]]; then
cd "${{ github.workspace }}/extended"
git clone --no-checkout https://github.com/MaintainTeam/LastPipeBender.git .
git config core.symlinks false
git checkout --progress --force "extended"
elif [[ "${{ inputs.style }}" -eq "3" ]]; then
cd "${{ github.workspace }}/master"
git clone --no-checkout https://github.com/MaintainTeam/LastPipeBender.git .
git config core.symlinks false
git checkout --progress --force "master"
cd "${{ github.workspace }}/extended"
2024-07-26 22:55:05 +03:00
git clone --no-checkout https://github.com/MaintainTeam/LastPipeBender.git .
2024-04-20 10:12:58 -06:00
git config core.symlinks false
2024-12-06 16:43:00 +03:00
git checkout --progress --force "extended"
else
cd "${{ github.workspace }}/current"
git clone --no-checkout https://github.com/MaintainTeam/LastPipeBender.git .
git config core.symlinks false
git checkout --progress --force "$BRANCH"
fi
2024-12-02 18:40:33 +03:00
- name : Set up JDK
2024-04-20 10:12:58 -06:00
uses : actions/setup-java@v4
with :
2024-12-02 18:40:33 +03:00
java-version : 21
2024-04-20 10:12:58 -06:00
distribution : "temurin"
cache : 'gradle'
- name : Build release APK
2024-12-06 16:43:00 +03:00
run : |
if [[ "${{ inputs.style }}" -eq "1" ]]; then
cd "${{ github.workspace }}/master"
echo "::notice::building master"
./gradlew assembleRelease
mv "${{ github.workspace }}/master/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/master.apk"
2025-01-22 02:09:42 +03:00
cp "./.github/changelog.md" "${{ github.workspace }}/output/"
2024-12-06 16:43:00 +03:00
elif [[ "${{ inputs.style }}" -eq "2" ]]; then
cd "${{ github.workspace }}/extended/"
echo "::notice::building extended"
./gradlew assembleRelease
mv "${{ github.workspace }}/extended/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/extended.apk"
2025-01-22 02:09:42 +03:00
cp "./.github/changelog.md" "${{ github.workspace }}/output/"
2024-12-06 16:43:00 +03:00
elif [[ "${{ inputs.style }}" -eq "3" ]]; then
echo "::notice::both master and extended are going to build"
cd "${{ github.workspace }}/master"
echo "::notice::building master"
./gradlew assembleRelease
mv "${{ github.workspace }}/master/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/master.apk"
2025-01-22 02:09:42 +03:00
cp "./.github/changelog.md" "${{ github.workspace }}/output/"
2024-12-06 16:43:00 +03:00
cd "${{ github.workspace }}/extended"
echo "::notice::building extended"
./gradlew assembleRelease
mv "${{ github.workspace }}/extended/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/extended.apk"
else
cd "${{ github.workspace }}/current"
echo "::notice::building current"
./gradlew assembleRelease
mv "${{ github.workspace }}/current/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/current.apk"
2025-01-22 02:09:42 +03:00
cp "./.github/changelog.md" "${{ github.workspace }}/output/"
2024-12-06 16:43:00 +03:00
fi
2024-04-21 14:40:09 -06:00
- name : Sign APK
2024-04-20 10:12:58 -06:00
env :
2024-04-21 14:40:09 -06:00
KEYSTORE : ${{ secrets.KEYSTORE }}
2024-04-20 10:12:58 -06:00
SIGNING_STORE_PASSWORD : ${{ secrets.SIGNING_STORE_PASSWORD }}
2024-04-21 14:40:09 -06:00
run : |
2024-12-06 16:43:00 +03:00
cd "${{ github.workspace }}/output/"
2024-04-21 14:40:09 -06:00
echo "${KEYSTORE}" | base64 -d > apksign.keystore
2024-12-06 16:43:00 +03:00
if [[ "${{ inputs.style }}" -eq "1" ]]; then
version=$( grep "versionName" "${{ github.workspace }}/master/app/build.gradle" | awk -F'"' '{print $2}' )
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "./master.apk"
2025-01-22 02:09:42 +03:00
mv "master.apk" "pipebender_v${version}.apk"
2024-12-06 16:43:00 +03:00
elif [[ "${{ inputs.style }}" -eq "2" ]]; then
version=$( grep "versionName" "${{ github.workspace }}/extended/app/build.gradle" | awk -F'"' '{print $2}' )
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "./extended.apk"
2025-01-22 02:09:42 +03:00
mv "extended.apk" "pipebender_extended_v${version}.apk"
2024-12-06 16:43:00 +03:00
elif [[ "${{ inputs.style }}" -eq "3" ]]; then
version=$( grep "versionName" "${{ github.workspace }}/master/app/build.gradle" | awk -F'"' '{print $2}' ) # Use version of master app while both released !
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "./master.apk"
2025-01-22 02:09:42 +03:00
mv "master.apk" "pipebender_v${version}.apk"
2024-12-06 16:43:00 +03:00
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "./extended.apk"
2025-01-22 02:09:42 +03:00
mv "extended.apk" "pipebender_extended_v${version}.apk"
2024-12-06 16:43:00 +03:00
else
mkdir "${{ github.workspace }}/current"
version=$( grep "versionName" "${{ github.workspace }}/current/app/build.gradle" | awk -F'"' '{print $2}' )
${ANDROID_HOME}/build-tools/34.0.0/apksigner sign --ks apksign.keystore --ks-pass env:SIGNING_STORE_PASSWORD "./current.apk"
2025-01-22 02:09:42 +03:00
mv "current.apk" "pipebender_v${version}.apk"
2024-12-06 16:43:00 +03:00
fi
2025-01-22 02:09:42 +03:00
echo ${version} > version.num
2024-12-06 16:43:00 +03:00
ls -la
2024-04-21 14:40:09 -06:00
2024-12-02 07:35:56 +03:00
- name : Generate checksum
2024-12-06 16:43:00 +03:00
run : |
cd "${{ github.workspace }}/output/"
2025-01-22 02:09:42 +03:00
find . -name '*.apk' -type f -exec sha256sum {} \; > checksums.txt
echo "::notice::$(echo $(cat ./checksums.txt))"
ls -la
2024-12-06 16:43:00 +03:00
2024-04-21 14:40:09 -06:00
- name : Create release and upload
run : |
gh auth login --with-token <<<"${{ secrets.GITHUB_TOKEN }}"
2025-01-22 02:09:42 +03:00
cd "${{ github.workspace }}/output/"
version=$(cat version.num)
echo $version
gh release create "v${version}" --title "${{ inputs.title }}" --notes-file "./changelog.md" --prerelease="true" --repo MaintainTeam/LastPipeBender
gh release upload "v${version}" $(echo $(find . -name '*.apk' -type f -exec basename \{} \;) checksums.txt) --repo MaintainTeam/LastPipeBender
2024-04-20 10:12:58 -06:00
2024-04-21 14:40:09 -06:00
- name : Archive reports for job
2024-04-20 10:12:58 -06:00
uses : actions/upload-artifact@v4
with :
2024-04-21 14:40:09 -06:00
name : reports
path : '*/build/reports'
2025-01-22 02:09:42 +03:00
if : ${{ always() }}