Release Build #126
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
name: Release Build | |
on: | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: 'Publish: If want ignore, enter "y"' | |
required: false | |
push: | |
tags: | |
- "v*" | |
jobs: | |
libcore: | |
name: Native Build (LibCore) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Golang Status | |
run: find buildScript libcore/*.sh | xargs cat | sha1sum > golang_status | |
- name: Libcore Status | |
run: git ls-files libcore | xargs cat | sha1sum > libcore_status | |
- name: LibCore Cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
app/libs/libcore.aar | |
key: ${{ hashFiles('.github/workflows/*', 'golang_status', 'libcore_status') }} | |
- name: Golang Version | |
if: steps.cache.outputs.cache-hit != 'true' | |
id: version | |
run: | | |
source buildScript/init/version.sh | |
echo go_version=$GO_VERSION >> $GITHUB_OUTPUT | |
- name: Install Golang | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ steps.version.outputs.go_version }} | |
cache-dependency-path: libcore/go.sum | |
- uses: actions/setup-java@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
java-version: "21" | |
distribution: "temurin" | |
- name: Patch Go | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd "$(go env GOROOT)" | |
curl "https://github.com/golang/go/commit/76a8409eb81eda553363783dcdd9d6224368ae0e.patch" | patch --verbose -p 1 | |
- name: Native Build | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
./run lib core | |
- name: Upload libcore | |
uses: actions/upload-artifact@v4 | |
with: | |
path: app/libs/libcore.aar | |
name: "libcore" | |
build: | |
name: Build FOSS APK | |
runs-on: ubuntu-latest | |
needs: | |
- libcore | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: LibCore Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: "libcore" | |
path: app/libs/libcore.aar | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "21" | |
distribution: "temurin" | |
- name: Gradle cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle | |
key: gradle-foss-${{ hashFiles('**/*.gradle.kts') }} | |
- name: Golang Version | |
if: steps.cache.outputs.cache-hit != 'true' | |
id: version | |
run: | | |
source buildScript/init/version.sh | |
echo go_version=$GO_VERSION >> $GITHUB_OUTPUT | |
- name: Install Golang | |
if: steps.cache.outputs.cache-hit != 'true' | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ steps.version.outputs.go_version }} | |
cache-dependency-path: libcore/go.sum | |
- name: Gradle Build | |
env: | |
BUILD_PLUGIN: none | |
run: | | |
echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
# export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" | |
./run init action gradle | |
KEYSTORE_PASS="${{ secrets.KEYSTORE_PASS }}" ALIAS_NAME="${{ secrets.ALIAS_NAME }}" ALIAS_PASS="${{ secrets.ALIAS_PASS}}" ./gradlew clean app:assembleFossRelease | |
APK=$(find app/build/outputs/apk -name '*arm64-v8a*.apk') | |
APK=$(dirname $APK) | |
rm $APK/output-metadata.json | |
echo "APK=$APK" >> $GITHUB_ENV | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: APKs | |
path: ${{ env.APK }} | |
publish: | |
name: Publish Release | |
if: github.event.inputs.publish != 'y' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: APKs | |
path: artifacts/ | |
- name: Release | |
run: | | |
curl -Lo - https://github.com/tcnksm/ghr/releases/download/v0.16.2/ghr_v0.16.2_linux_amd64.tar.gz | tar xzv | |
mv ghr*linux_amd64/ghr . | |
./ghr -delete -prerelease -t "${{ github.token }}" -n "${{ github.ref }}" "${{ github | |
.ref }}" ./artifacts/ |