Skip to content

Commit

Permalink
Update GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
RayWangQvQ committed Jan 26, 2022
1 parent 65fc0db commit 5c4d738
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-close-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: pull_request_target
jobs:
autoclose:
runs-on: ubuntu-latest
if: github.repository == 'RayWangQvQ/BiliBiliTool'
if: github.repository == 'RayWangQvQ/BiliBiliToolPro'
steps:
- uses: roots/[email protected]
with:
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/bilibili-daily-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,26 @@ env:
Ray_Serilog__WriteTo__0__Args__outputTemplate: ${{secrets.CONSOLELOGTEMPLATE}}

jobs:
run-daily-task:

pre-check:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.check.outputs.result }} # 不能直接传递secrets的值,否则会被skip,需要转一下
steps:
- id: check
if: env.IsOpenDailyTask=='true'
run: |
echo "::set-output name=result::开启"
run-daily-task:

runs-on: ubuntu-latest
environment: Production
needs: pre-check
if: needs.pre-check.outputs.result=='开启'

steps:

# 输出IP
- name: IP
run: sudo curl ifconfig.me

# 设置服务器时区为东八区
- name: Set time zone
run: sudo timedatectl set-timezone 'Asia/Shanghai'
Expand All @@ -83,10 +91,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x

# 测试运行
- name: Test APP
run: |
cd ./src/Ray.BiliBiliTool.Console
dotnet run Ray.BiliBiliTool.Console.dll -runTasks=Daily
dotnet run --runTasks=Daily
18 changes: 4 additions & 14 deletions .github/workflows/empty-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ jobs:

steps:

# 输出IP
- name: IP
run: sudo curl ifconfig.me

# 设置服务器时区为东八区
- name: Set time zone
run: sudo timedatectl set-timezone 'Asia/Shanghai'
Expand All @@ -85,16 +81,10 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

# 发布
- name: Publish
run: |
cd ./src/Ray.BiliBiliTool.Console
dotnet publish --configuration Release --self-contained false --output ./bin/Publish/net5-dependent
dotnet-version: 6.0.x

# 运行
- name: Run APP
run: |
cd ./src/Ray.BiliBiliTool.Console/bin/Publish/net5-dependent
dotnet Ray.BiliBiliTool.Console.dll -runTasks=${{ github.event.inputs.tasks }}
cd ./src/Ray.BiliBiliTool.Console
dotnet run --runTasks=${{ github.event.inputs.tasks }}
100 changes: 100 additions & 0 deletions .github/workflows/live-lottery-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 天选时刻抽奖任务

name: live-lottery-task


on:

workflow_dispatch: # 手动触发
schedule: # 计划任务触发
- cron: '0 16 * * *'
# cron表达式,时区是UTC时间,比我们早8小时,如上所表示的是每天0点0分(24点整)
# 建议每个人通过设置名称为 LiveLottery 的 GitHub Environments 来设定为自己的目标运行时间(详细设置方法见文档说明)

env:
IsOpenLiveLotteryTask: ${{secrets.ISOPENLIVELOTTERYTASK}} #是否开启该GitHub工作流
ASPNETCORE_ENVIRONMENT: ${{secrets.ENV}} # 运行环境
Ray_CloseConsoleWhenEnd: 1
Ray_BiliBiliCookies__1: ${{secrets.COOKIESTR}}
Ray_BiliBiliCookies__2: ${{secrets.COOKIESTR2}}
Ray_BiliBiliCookies__3: ${{secrets.COOKIESTR3}}
# 天选任务:
Ray_LiveLotteryTaskConfig__ExcludeAwardNames: ${{secrets.EXCLUDEAWARDNAMES}} # 天选抽奖指定排除关键字
Ray_LiveLotteryTaskConfig__IncludeAwardNames: ${{secrets.INCLUDEAWARDNAMES}} # 天选抽奖指定包含关键字
Ray_LiveLotteryTaskConfig__AutoGroupFollowings: ${{secrets.AUTOGROUPFOLLOWINGS}} # 抽奖结束后是否将关注主播自动分组
# 推送:
Ray_Serilog__WriteTo__3__Args__botToken: ${{secrets.PUSHTGTOKEN}} # Telegram
Ray_Serilog__WriteTo__3__Args__chatId: ${{secrets.PUSHTGCHATID}}
Ray_Serilog__WriteTo__3__Args__restrictedToMinimumLevel: ${{secrets.PUSHTGLEVEL}}
Ray_Serilog__WriteTo__4__Args__webHookUrl: ${{secrets.PUSHWEIXINURL}} # 企业微信
Ray_Serilog__WriteTo__4__Args__restrictedToMinimumLevel: ${{secrets.PUSHWEIXINLEVEL}}
Ray_Serilog__WriteTo__5__Args__webHookUrl: ${{secrets.PUSHDINGURL}} # 钉钉
Ray_Serilog__WriteTo__5__Args__restrictedToMinimumLevel: ${{secrets.PUSHDINGLEVEL}}
Ray_Serilog__WriteTo__6__Args__scKey: ${{secrets.PUSHSCKEY}} # Server酱
Ray_Serilog__WriteTo__6__Args__turboScKey: ${{secrets.PUSHSERVERTSCKEY}}
Ray_Serilog__WriteTo__6__Args__restrictedToMinimumLevel: ${{secrets.PUSHSERVERLEVEL}}
Ray_Serilog__WriteTo__7__Args__sKey: ${{secrets.PUSHCOOLSKEY}} # 酷推
Ray_Serilog__WriteTo__7__Args__restrictedToMinimumLevel: ${{secrets.PUSHCOOLLEVEL}}
Ray_Serilog__WriteTo__8__Args__api: ${{secrets.PUSHOTHERAPI}} # 自定义api
Ray_Serilog__WriteTo__8__Args__placeholder: ${{secrets.PUSHOTHERPLACEHOLDER}}
Ray_Serilog__WriteTo__8__Args__bodyJsonTemplate: ${{secrets.PUSHOTHERBODYJSONTEMPLATE}}
Ray_Serilog__WriteTo__8__Args__restrictedToMinimumLevel: ${{secrets.PUSHOTHERLEVEL}}
Ray_Serilog__WriteTo__9__Args__token: ${{secrets.PUSHPLUSTOKEN}} # PushPlus
Ray_Serilog__WriteTo__9__Args__topic: ${{secrets.PUSHPLUSTOPIC}}
Ray_Serilog__WriteTo__9__Args__channel: ${{secrets.PUSHPLUSCHANNEL}}
Ray_Serilog__WriteTo__9__Args__webhook: ${{secrets.PUSHPLUSWEBHOOK}}
Ray_Serilog__WriteTo__9__Args__restrictedToMinimumLevel: ${{secrets.PUSHPLUSLEVEL}}
# 安全相关:
Ray_Security__IsSkipDailyTask: ${{secrets.ISSKIPDAILYTASK}}
Ray_Security__IntervalSecondsBetweenRequestApi: ${{secrets.INTERVALSECONDSBETWEENREQUESTAPI}}
Ray_Security__IntervalMethodTypes: ${{secrets.INTERVALMETHODTYPES}}
Ray_Security__UserAgent: ${{secrets.USERAGENT}}
Ray_Security__WebProxy: ${{secrets.WEBPROXY}}
Ray_Security__RandomSleepMaxMin: ${{secrets.RANDOMSLEEPMAXMIN}}
# Console日志:
Ray_Serilog__WriteTo__0__Args__restrictedToMinimumLevel: ${{secrets.CONSOLELOGLEVEL}}
Ray_Serilog__WriteTo__0__Args__outputTemplate: ${{secrets.CONSOLELOGTEMPLATE}}

jobs:

pre-check:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.check.outputs.result }} # 不能直接传递secrets的值,否则会被skip,需要转一下
steps:
- id: check
if: env.IsOpenLiveLotteryTask=='true'
run: |
echo "::set-output name=result::开启"
run-live-lottery:
runs-on: ubuntu-latest
needs: pre-check
# if: env.IsOpenLiveLotteryTask=='true' # 这里job.if读取不到env或secrets,很坑...但是发现可以读到needs的outputs值
if: needs.pre-check.outputs.result=='开启'

environment: LiveLottery

steps:

# 输出IP、设置服务器时区为东八区
- name: PreWork
run: |
sudo curl ifconfig.me
sudo timedatectl set-timezone 'Asia/Shanghai'
# 检出
- name: Checkout
uses: actions/checkout@v2

# .Net 环境
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x

# 测试运行
- name: Test APP
run: |
cd ./src/Ray.BiliBiliTool.Console
dotnet run --runTasks=LiveLottery
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
build:
name: publish relesae
if: ${{ github.repository == 'RayWangQvQ/BiliBiliTool' }}
if: ${{ github.repository == 'RayWangQvQ/BiliBiliToolPro' }}
runs-on: ubuntu-latest

steps:
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x

- name: Publish and zip
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/repo-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
repo-sync:
if: ${{ github.repository != 'RayWangQvQ/BiliBiliTool' }}
if: ${{ github.repository != 'RayWangQvQ/BiliBiliToolPro' }}

runs-on: ubuntu-latest
steps:
Expand All @@ -21,7 +21,7 @@ jobs:
- name: repo-sync
uses: repo-sync/github-sync@v2
with:
source_repo: "https://github.com/RayWangQvQ/BiliBiliTool.git"
source_repo: "https://github.com/RayWangQvQ/BiliBiliToolPro.git"
source_branch: "main"
destination_branch: "main"
sync_tags: "true"
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/unfollow-batched-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ jobs:

steps:

# 输出IP
- name: IP
run: sudo curl ifconfig.me

# 设置服务器时区为东八区
- name: Set time zone
run: sudo timedatectl set-timezone 'Asia/Shanghai'
Expand All @@ -74,7 +70,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x

# 发布
- name: Publish
Expand All @@ -85,5 +81,5 @@ jobs:
# 测试运行
- name: Test APP
run: |
cd ./src/Ray.BiliBiliTool.Console/bin/Publish/net5-dependent
dotnet Ray.BiliBiliTool.Console.dll -runTasks=UnfollowBatched
cd ./src/Ray.BiliBiliTool.Console
dotnet run -runTasks=UnfollowBatched
13 changes: 11 additions & 2 deletions Ray.BiliBiliTool.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30611.23
# Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{38736647-2196-417E-8519-C48A012A63D9}"
EndProject
Expand Down Expand Up @@ -50,6 +50,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{73DD457B-E06E-45ED-A6BA-7E3C02F8BDF1}"
ProjectSection(SolutionItems) = preProject
.github\pull.yml = .github\pull.yml
.github\PULL_REQUEST_TEMPLATE.md = .github\PULL_REQUEST_TEMPLATE.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{61613EF4-3644-42D4-A620-70547291FB38}"
Expand Down Expand Up @@ -125,6 +126,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DefaultTasks", "DefaultTask
qinglong\DefaultTasks\bili_task_unfollowBatched.sh = qinglong\DefaultTasks\bili_task_unfollowBatched.sh
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEMPLATE", "{830361B7-BCC1-4853-879A-761B0FD86826}"
ProjectSection(SolutionItems) = preProject
.github\ISSUE_TEMPLATE\bug-report----.md = .github\ISSUE_TEMPLATE\bug-report----.md
.github\ISSUE_TEMPLATE\feature-request----.md = .github\ISSUE_TEMPLATE\feature-request----.md
.github\ISSUE_TEMPLATE\other----.md = .github\ISSUE_TEMPLATE\other----.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -233,6 +241,7 @@ Global
{DD86F293-AE70-46CF-837C-8870D8F51237} = {F3DE0D72-426B-4AD9-B3ED-3343CF4223F1}
{1C6CC38A-A5D5-41EF-9072-70AEEEA211F7} = {F3DE0D72-426B-4AD9-B3ED-3343CF4223F1}
{DE60A16C-CA3B-45E9-8A9D-0E91ACEBDEE0} = {1C6CC38A-A5D5-41EF-9072-70AEEEA211F7}
{830361B7-BCC1-4853-879A-761B0FD86826} = {73DD457B-E06E-45ED-A6BA-7E3C02F8BDF1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {197319DA-1148-4A99-847C-8B270B6A29AB}
Expand Down
30 changes: 29 additions & 1 deletion src/Ray.BiliBiliTool.Console/commandLineMappings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
{
//命令行启动时的参数映射
"CommandLineMappings": {
"-cookieStr": "BiliBiliCookie:CookieStr",
"--cookieStr1": "BiliBiliCookies:1",

"--runTasks": "RunTasks",

"--numberOfCoins": "DailyTaskConfig:NumberOfCoins",
"--selectLike": "DailyTaskConfig:SelectLike",
"--supportUpIds": "DailyTaskConfig:SupportUpIds",
"--dayOfAutoCharge": "DailyTaskConfig:DayOfAutoCharge",
"--autoChargeUpId": "DailyTaskConfig:AutoChargeUpId",
"--dayOfReceiveVipPrivilege": "DailyTaskConfig:DayOfReceiveVipPrivilege",
"--isExchangeSilver2Coin": "DailyTaskConfig:IsExchangeSilver2Coin",
"--devicePlatform": "DailyTaskConfig:DevicePlatform",

"--excludeAwardNames": "LiveLotteryTaskConfig:ExcludeAwardNames",
"--includeAwardNames": "LiveLotteryTaskConfig:INCLUDEAWARDNAMES",

"--unfollowGroup": "UnfollowBatchedTaskConfig:GroupName",
"--unfollowCount": "UnfollowBatchedTaskConfig:Count",

"--intervalSecondsBetweenRequestApi": "Security:IntervalSecondsBetweenRequestApi",
"--intervalMethodTypes": "Security:IntervalMethodTypes",

"--pushScKey": "Serilog:WriteTo:6:Args:scKey",

"--proxy": "WebProxy",




"-cookieStr1": "BiliBiliCookies:1",

"-runTasks": "RunTasks",
Expand Down

0 comments on commit 5c4d738

Please sign in to comment.