release #55
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 | |
on: | |
push: | |
tags: | |
- '**' | |
workflow_dispatch: | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
submodules: recursive | |
token: ${{ secrets.TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: 'easybangumiorg/EasyBangumiPrivate' | |
token: ${{ secrets.TOKEN }} | |
path: 'private' | |
ref: main | |
- name: Setup Java JDK | |
uses: actions/[email protected] | |
with: | |
java-version: 17 | |
# Gradle 缓存配置 | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle | |
env: | |
RELEASE: true | |
- name: Build | |
run: | | |
cd private | |
ls | |
cd .. | |
mv private/google-service.json app/google-service.json | |
chmod +x ./gradlew | |
./gradlew :app:assemble | |
env: | |
APPCENTER_SECRET: ${{ secrets.APPCENTER_SECRET }} | |
BUGLY_APPID: ${{ secrets.BUGLY_APPID }} | |
RELEASE: true | |
- name: Setup build tool version variable | |
shell: bash | |
run: | | |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) | |
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV | |
echo Last build tool version is: $BUILD_TOOL_VERSION | |
- name: sign-apk | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PWD }} | |
keyPassword: ${{ secrets.KEY_PWD }} | |
env: | |
# override default build-tools version (29.0.3) -- optional | |
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} | |
- name: rename-apk | |
run: | | |
mv app/build/outputs/apk/release/app-release-unsigned-signed.apk easybangumi-${{ github.ref_name }}.apk | |
- name: Release | |
run: | | |
gh release create -d ${{ github.ref_name }} easybangumi-${{ github.ref_name }}.apk | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
- name: push_mapping | |
run: | | |
cd private | |
rm -r ./mapping/${{ github.ref_name }} || ls | |
mkdir -p ./mapping/${{ github.ref_name }} | |
mv ../app/build/outputs/mapping/release/* ./mapping/${{ github.ref_name }} | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "[auto] mapping" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
force: true | |
github_token: ${{ secrets.token }} | |
branch: main | |
directory: private | |
repository: 'easybangumiorg/EasyBangumiPrivate' |