2022-08-01 07:46:59 +00:00
|
|
|
|
name: Weekly Build
|
|
|
|
|
|
|
|
|
|
# 触发器
|
|
|
|
|
on:
|
|
|
|
|
schedule:
|
2022-08-01 07:59:58 +00:00
|
|
|
|
- cron: '0 15 * * 0' #每周天在国际标准时间15点(北京时间+8,即 23:00)
|
2022-08-01 07:46:59 +00:00
|
|
|
|
workflow_dispatch:
|
|
|
|
|
inputs:
|
|
|
|
|
root_sol:
|
|
|
|
|
description: "Weekly Build Title"
|
|
|
|
|
required: true
|
|
|
|
|
default: "SmsForwarder"
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
build:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
2022-08-02 06:27:49 +00:00
|
|
|
|
# 检出代码
|
|
|
|
|
- uses: actions/checkout@v2
|
2022-08-02 06:22:03 +00:00
|
|
|
|
# 删除旧的工作流
|
|
|
|
|
- name: Delete Weekly Build
|
|
|
|
|
uses: Mattraks/delete-workflow-runs@v2
|
|
|
|
|
with:
|
|
|
|
|
token: ${{ github.token }}
|
|
|
|
|
repository: ${{ github.repository }}
|
2022-08-02 06:43:02 +00:00
|
|
|
|
retain_days: 0 # 全部删除只留正在跑的一条
|
2022-08-02 06:46:41 +00:00
|
|
|
|
keep_minimum_runs: 0 # 全部删除只留正在跑的一条
|
2022-08-02 06:22:03 +00:00
|
|
|
|
delete_workflow_pattern: 'Weekly Build'
|
|
|
|
|
# 设置jdk环境为11
|
2022-08-01 07:46:59 +00:00
|
|
|
|
- name: set up JDK 11
|
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
|
with:
|
|
|
|
|
java-version: 11
|
|
|
|
|
# 获取打包秘钥
|
|
|
|
|
- name: Checkout Android Keystore
|
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
with:
|
|
|
|
|
repository: pppscn/keystore
|
|
|
|
|
token: ${{ secrets.TOKEN }} # 连接仓库的token,需要单独配置
|
|
|
|
|
path: keystore # 仓库的根目录名
|
|
|
|
|
# 打包release
|
|
|
|
|
- name: Build with Gradle
|
|
|
|
|
run: bash ./gradlew assembleRelease
|
|
|
|
|
# 存档打包的文件
|
|
|
|
|
- name: Archive production artifacts
|
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
name: SmsForwarder Weekly Build
|
|
|
|
|
path: app/build/outputs/apk/release/*.apk
|
|
|
|
|
if-no-files-found: error
|