forked from Divested-Mobile/Hypatia
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from MaintainTeam/release-ci
ci: create release file
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- THIS IS A PRE-RELEASE/RELEASE OUTPUT BY GITHUB ACTIONS - WAIT MAINTAINER/AUTHOR TO UPDATE THIS CHANGELOG ! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
title: | ||
type: string | ||
description: 'Title' | ||
required: true | ||
default: 'v0.00.0 R0' | ||
|
||
jobs: | ||
build-and-release: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: write-all | ||
|
||
steps: | ||
- name: Checkout | ||
env: | ||
BRANCH: ${{ github.ref_name }} | ||
run: | | ||
mkdir -p "${{ github.workspace }}/stable" | ||
git clone --no-checkout https://github.com/MaintainTeam/Hypatia.git . | ||
git checkout --progress --force "stable" | ||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
distribution: "temurin" | ||
cache: 'gradle' | ||
|
||
- name: Build release APK | ||
run: | | ||
cd "${{ github.workspace }}/stable" | ||
echo "::notice::building stable" | ||
./gradlew assembleRelease | ||
mv "${{ github.workspace }}/stable/app/build/outputs/apk/release/app-release-unsigned.apk" "${{ github.workspace }}/output/stable.apk" | ||
cp "./.github/changelog.md" "${{ github.workspace }}/output/" | ||
- name: Sign APK | ||
env: | ||
KEYSTORE: ${{ secrets.KEYSTORE }} | ||
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | ||
run: | | ||
cd "${{ github.workspace }}/output/" | ||
echo "${KEYSTORE}" | base64 -d > apksign.keystore | ||
version=$( grep "versionName" "${{ github.workspace }}/stable/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 "./stable.apk" | ||
mv "stable.apk" "hypatia_v${version}.apk" | ||
echo ${version} > version.num | ||
ls -la | ||
- name: Generate checksum | ||
run: | | ||
cd "${{ github.workspace }}/output/" | ||
find . -name '*.apk' -type f -exec sha256sum {} \; > checksums.txt | ||
echo "::notice::$(echo $(cat ./checksums.txt))" | ||
ls -la | ||
- name: Create release and upload | ||
run: | | ||
gh auth login --with-token <<<"${{ secrets.GITHUB_TOKEN }}" | ||
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/Hypatia | ||
gh release upload "v${version}" $(echo $(find . -name '*.apk' -type f -exec basename \{} \;) checksums.txt) --repo MaintainTeam/Hypatia | ||
- name: Archive reports for job | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: reports | ||
path: '*/build/reports' | ||
if: ${{ always() }} |