diff --git a/.github/changelog.md b/.github/changelog.md new file mode 100644 index 0000000..8b27c38 --- /dev/null +++ b/.github/changelog.md @@ -0,0 +1 @@ +- THIS IS A PRE-RELEASE/RELEASE OUTPUT BY GITHUB ACTIONS - WAIT MAINTAINER/AUTHOR TO UPDATE THIS CHANGELOG ! diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..88b81c0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,81 @@ +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" + cd "${{ 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() }} \ No newline at end of file