-
Notifications
You must be signed in to change notification settings - Fork 55
107 lines (99 loc) · 4.79 KB
/
RepoA-Package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#=================================================
# https://github.com/P3TERX/Actions-OpenWrt
# Description: Build OpenWrt using GitHub Actions
# Lisence: MIT
# Author: P3TERX
# Blog: https://p3terx.com
#=================================================
name: Repo-2
on:
# push:
# branches:
# - master
schedule:
- cron: 0 4 * * *
watch:
types: started
workflow_dispatch:
inputs:
packages:
description: 'Packages'
required: false
default: ''
env:
REPO_TOKEN: ${{ secrets.TOKEN_kenzo }}
TZ: Asia/Shanghai
jobs:
build:
if: github.event.repository.owner.id == github.event.sender.id || ! github.event.sender.id
runs-on: ubuntu-latest
steps:
- name: cancel running workflows
uses: styfle/cancel-workflow-action@main
if: contains(github.event.inputs.packages, ' cw')
with:
workflow_id: all
access_token: ${{ github.token }}
- name: Trigger matrix Update
run: |
gitdate=$(curl -H "Authorization: token ${{ env.REPO_TOKEN }}" -s "https://api.github.com/repos/kenzok8/small-package/commits?&per_page=1" | jq -r '.[0].commit.committer.date') || true
fpkg="$(echo "${{github.event.action}}" | sed -e 's/\(aarch64_generic\|x86_64\|i386_pentium4\|arm_arm1176jzf-s_vfp\|aarch64_cortex-a72\|arm_cortex-a7\|arm_cortex-a7_neon-vfpv4\|arm_cortex-a9\|arm_cortex-a15_neon-vfpv4\|arm_cortex-a5_vfpv4\|mipsel_24kc\|mips_24kc\|aarch64_cortex-a53\|arm_xscale\|arm_cortex-a9_vfpv3-d16\| [0-9][0-9.]*\| ssh\| noser\| cw\)//g' | sed -e 's/ //g')"
during="$(echo "${{github.event.inputs.packages}}" | grep -o -E ' [0-9][0-9.]*' | sed -e 's/ //')"
[[ "$fpkg" && ! "$during" ]] || {
[ "$during" ] || during="1.05"
durings=`echo "$during*60*60*24" | bc`
gitdate=$(date -d "$gitdate" +%s)
now=$(date -d "$(date)" +%s)
[ "$during" ] || during="1.05"
durings=`echo "$during*60*60*24" | bc`
if [[ $(expr $gitdate + ${durings%.*}) -lt $now ]]; then
exit;
fi
gitdate=$(curl -H "Authorization: token ${{ env.REPO_TOKEN }}" -s "https://api.github.com/repos/kenzok8/small-package/actions/runs" | jq -r '.workflow_runs[0].created_at') || true
gitdate=$(date -d "$gitdate" +%s)
now=$(date -d "$(date)" +%s)
if [[ $(expr $gitdate + 180) < $now ]]; then
curl -X POST https://api.github.com/repos/kenzok8/small-package/dispatches \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${{ env.REPO_TOKEN }}" \
--data '{"event_type": "update"}'
fi
}
curl \
-X POST https://api.github.com/repos/${{ github.repository }}/dispatches \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${{ env.REPO_TOKEN }}" \
-d '{"event_type": "aarch64_cortex-a72 ${{ github.event.inputs.packages }}", "client_payload": {"target": "aarch64_cortex-a72"}}'
curl \
-X POST https://api.github.com/repos/${{ github.repository }}/dispatches \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${{ env.REPO_TOKEN }}" \
-d '{"event_type": "aarch64_cortex-a53 ${{ github.event.inputs.packages }}", "client_payload": {"target": "aarch64_cortex-a53"}}'
curl \
-X POST https://api.github.com/repos/${{ github.repository }}/dispatches \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${{ env.REPO_TOKEN }}" \
-d '{"event_type": "mipsel_24kc ${{ github.event.inputs.packages }}", "client_payload": {"target": "mipsel_24kc"}}'
curl \
-X POST https://api.github.com/repos/${{ github.repository }}/dispatches \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${{ env.REPO_TOKEN }}" \
-d '{"event_type": "mips_24kc ${{ github.event.inputs.packages }}", "client_payload": {"target": "mips_24kc"}}'
curl \
-X POST https://api.github.com/repos/${{ github.repository }}/dispatches \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${{ env.REPO_TOKEN }}" \
-d '{"event_type": "arm_cortex-a7_neon-vfpv4 ${{ github.event.inputs.packages }}", "client_payload": {"target": "arm_cortex-a7_neon-vfpv4"}}'
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
continue-on-error: true
with:
retain_days: 5
keep_minimum_runs: 1
- name: Remove old Releases
uses: dev-drprasad/delete-older-releases@master
with:
keep_latest: 100
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_kenzo }}