This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (74 loc) · 3 KB
/
collector.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
name: Collector
on:
workflow_dispatch:
inputs:
branch:
description: "Source branch(master,openwrt-18.06,...)"
required: false
default: "master"
target:
description: "Target(x86,bcm27xx,...)"
required: false
default: "x86"
subtarget:
description: "Subtarget(64,bcm2711,...)"
required: false
default: "64"
dataURL:
description: "the url for build logs archive"
required: true
jobs:
collector:
runs-on: ubuntu-latest
steps:
- name: show input
run: |-
echo "Source branch: ${{ github.event.inputs.branch }}"
echo "Target: ${{ github.event.inputs.target }}"
echo "Subtarget: ${{ github.event.inputs.subtarget }}"
echo "upload to onedrive: ${{ github.event.inputs.onedrive }}"
echo "the url for build logs archive: ${{ github.event.inputs.dataURL }}"
- name: Checkout gh-pages
uses: actions/checkout@v2
with:
submodules: true
path: ./db
ref: "gh-pages"
fetch-depth: "0"
- name: pull docker image
run: |
docker pull immortalwrt/opde:worker-${{ github.event.inputs.target }}_${{ github.event.inputs.subtarget }}-${{ github.event.inputs.branch }}
docker tag immortalwrt/opde:worker-${{ github.event.inputs.target }}_${{ github.event.inputs.subtarget }}-${{ github.event.inputs.branch }} immortalwrt/opde:worker
docker images
- name: Download all logs
run: |
docker run -v $PWD:/openwrt immortalwrt/opde:worker sudo transfer ${{github.event.inputs.dataURL}} -o Logs.tar.gz
sudo chown $(id -u -n):$(id -g -n) Logs.tar.gz
sha256sum Logs.tar.gz
tar -xzf Logs.tar.gz # extract openwrt dir
- name: update db
run: |
declare -a list
list=($(find ./openwrt -mindepth 1 -maxdepth 1))
db_size=$(stat -c%s "$PWD/db/logs.db.json")
echo "database size: ${db_size} bytes"
compress_flag=""
(( db_size > 31457280)) && compress_flag="-c" # compress if database greater than 30MB
docker run -v $PWD/openwrt:/openwrt immortalwrt/opde:worker sudo chown opde:opde -R /openwrt
docker run -v $PWD/db:/db immortalwrt/opde:worker sudo chown opde:opde -R /db
for i in ${list[@]};do cmd="docker run -v $PWD/$i:/openwrt -v $PWD/db:/db immortalwrt/opde:worker opde extract $compress_flag /db ${{github.run_number}}"; echo $cmd; $cmd;done
- name: Hugo fresh
run: docker run -v $PWD/db:/openwrt immortalwrt/opde:worker hugo
- name: Fix premission
run: |
sudo chown $(id -u -n):$(id -g -n) -R $PWD/db
sudo chown $(id -u -n):$(id -g -n) -R $PWD/openwrt
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
default_author: github_actions
message: "Action ${{github.run_number}}"
push: true
branch: gh-pages
add: "."
cwd: ./db