Skip to content

Repo-3

Repo-3 #313

Workflow file for this run

#=================================================
# https://github.com/P3TERX/Actions-OpenWrt
# Description: Build OpenWrt using GitHub Actions
# Lisence: MIT
# Author: P3TERX
# Blog: https://p3terx.com
#=================================================
name: Repo-3
on:
# push:
# branches:
# - master
schedule:
- cron: 0 6 * * *
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": "arm_cortex-a7 ${{ github.event.inputs.packages }}", "client_payload": {"target": "arm_cortex-a7"}}'
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-a9 ${{ github.event.inputs.packages }}", "client_payload": {"target": "arm_cortex-a9"}}'
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-a9_vfpv3-d16 ${{ github.event.inputs.packages }}", "client_payload": {"target": "arm_cortex-a9_vfpv3-d16"}}'
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-a15_neon-vfpv4 ${{ github.event.inputs.packages }}", "client_payload": {"target": "arm_cortex-a15_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 }}