Skip to content

Update android.yml

Update android.yml #66

Workflow file for this run

name: Android CI
on:
workflow_dispatch:
push:
branches: '*'
# 在push tag时触发
tags: []
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: check commit sha
uses: zhangjing-GitHub-Code/[email protected]
id: sha
- name: Set commit sha to ENV
run: |
echo "sha=${{ github.sha }}" >> $GITHUB_ENV
- name: print got sha
#if: ${{ env.cont == true }}
run: echo "Sha is ${{ env.sha }}"
- name: exit if triggered by tag
if: ${{ env.cont == false }}
run: exit 1
- name: Setup timezone
# You may pin to the exact commit or the version.
# uses: zcong1993/setup-timezone@7215c3ec086d387e4618c4b81482d06d998c90a9
uses: zcong1993/[email protected]
with:
# which timezone you want to use
timezone: Asia/Shanghai # default is UTC
- name: F**k you bad packet header
run: |
git config --global pack.windowMemory "1001m"
git config --global pack.packSizeLimit "1001m"
git config --global pack.threads "1"
git config --global pack.deltaCacheSize "512m"
- name: Checkout
uses: actions/checkout@v3
- name: Check release double times
run: |
# find . -name *se*sh*
# ls
# ls ..
# find .. -name *.sh
/bin/bash checkIsRelease.sh "\"${{ github.event.name }}\"" "\"${{ github.ref }}\""
- name: fuck at JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Checkout Android Keystore
uses: actions/checkout@v3
with:
repository: zhangjing-GitHub-Code/jks-props
token: ${{ secrets.KS_REPO_PAT }} # 连接仓库的token,需要单独配置
path: keystore # 仓库的根目录名
- name: force gradle daemon
run: |
export GRADLE_OPTS=-Dorg.gradle.daemon=true:$GRADLE_OPTS
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: gradle-deps-*
restore-keys: gradle-deps
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: gradle-dep-any
restore-keys: gradle-dep-any
# well this embedded build
- uses: burrunan/[email protected]
name: Gradle build with better cache
# Extra environment variables for Gradle execution (regular GitHub Actions feature)
# Note: env must be outside of "with"
env:
VARIABLE: VALUE
GRADLE_OPTS: '-Dorg.gradle.daemon=true'
with:
# If you have multiple jobs, use distinct job-id in in case you want to split caches
# For instance, jobs with different JDK versions can't share caches
# RUNNER_OS is added to job-id automatically
job-id: jdk11
# Specifies arguments for Gradle execution
# If arguments is missing or empty, then Gradle is not executed
arguments: --daemon build
# arguments can be multi-line for better readability
# arguments: |
# --daemon
# --no-paralell
# build
# -x test
# Gradle version to use for execution:
# wrapper (default), current, rc, nightly, release-nightly, or
# versions like 6.6 (see https://services.gradle.org/versions/all)
gradle-version: wrapper
# Properties are passed as -Pname=value
properties: |
kotlin.js.compiler=ir
kotlin.parallel.tasks.in.project=true
#- name: Fuck execute permission for gradlew
#run: chmod +x gradlew
#- name: Build♂with♂Gradle
#run: cd FCL&&../gradlew build
#step:上传apk 到action,在右上角查看
# 官方文档 https://help.github.com/cn/actions/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts#uploading-build-and-test-artifactst
- name: Fuck↑ APK to artifacts
uses: actions/upload-artifact@v3
with:
name: FCL-release-selfsigned.apk
path: FCL/build/outputs/apk/release/FCL-release.apk
asset_content_type: application/apk
- name: Get current date
id: gdate
run: echo "::set-output name=today::$(date +'%Y-%m-%d_%H_%M_%S')"
- name: Create Release and Upload Release Asset
uses: softprops/action-gh-release@v1
with:
tag_name: "acb-${{ env.sha }}"
name: "Auto build Release ${{ env.sha }}"
token: ${{ secrets.GITHUB_TOKEN }}
body: "Action Build Release at ${{ steps.gdate.outputs.today }}."
draft: false
prerelease: false
files: |
FCL/build/outputs/apk/release/FCL-release.apk
# /home/runner/work/FoldCraftLauncher-tryautobuild/FoldCraftLauncher-tryautobuild/FCL/build/outputs/apk/release/FCL*.apk
# FCL/build/outputs/apk/release/FCL*.apk