forked from smallprogram/OpenWrtAction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build-OpenWrtSelfHost_R5S.yml
153 lines (121 loc) · 6.91 KB
/
Build-OpenWrtSelfHost_R5S.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#
# Copyright (c) 2022-2023 SMALLPROGRAM <https://github.com/smallprogram/OpenWrtAction>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/smallprogram/OpenWrtAction
# Description: Build OpenWrt using GitHub Actions
#
name: Build-OpenWrtSelfHost_R5S
on:
repository_dispatch:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'
# schedule:
# - cron: 0 */8 * * *
env:
TZ: Asia/Shanghai
RELEASE_TAG: R5S
CONFIG_NAME: R5S.config
UPLOAD_RELEASE: true
COMMIT_LOG_NUM: 1
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@main
- name: SSH connection to Actions
uses: P3TERX/[email protected]
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh')
- name: Update Action Source
id: UpdateSource
run: |
cd /home/$USER/actions-runner/_work/OpenWrtAction/OpenWrtAction
bash SelfHostCheck.sh
echo "status=success" >> $GITHUB_OUTPUT
- name: Compile the firmware
id: complie
if: steps.UpdateSource.outputs.status == 'success' && !cancelled()
run: |
cd /home/$USER/OpenWrtAction
bash wsl2op.sh $CONFIG_NAME
echo "status=success" >> $GITHUB_OUTPUT
# - name: Compile Error Post Log To Issue
# id: test
# if: steps.complie.outputs.status != 'success' && !cancelled()
# run: |
# do someting
# - name: Organize files
# id: organize
# if: steps.complie.outputs.status == 'success' && !cancelled()
# run: |
# cd /home/$USER/lede_$CONFIG_NAME/bin/targets/*/*
# rm -rf packages
# - name: Generate release tag
# id: tag
# if: steps.complie.outputs.status == 'success' && env.UPLOAD_RELEASE == 'true' && !cancelled()
# run: |
# cd /home/$USER
# mkdir -p openwrt_releaselog/$CONFIG_NAME
# cd openwrt_releaselog/$CONFIG_NAME
# find . -name "*.txt" | xargs rm -rf
# cd /home/$USER
# echo "release_tag=SelfHost-$RELEASE_TAG-$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_OUTPUT
# echo "## Update content" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# echo "<details> <summary> Lean Openwrt Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# git -C lede_$CONFIG_NAME log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# echo "</details> <details> <summary> Lean Package Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# git -C lede_$CONFIG_NAME/feeds/packages log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# echo "</details> <details> <summary> Lean Luci Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# git -C lede_$CONFIG_NAME/feeds/luci log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# echo "</details> <details> <summary> Openwrt routing Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# git -C lede_$CONFIG_NAME/feeds/routing log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# echo "</details> <details> <summary> Openwrt telephony Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# git -C lede_$CONFIG_NAME/feeds/telephony log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# echo "</details> <details> <summary> SSRP Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# git -C lede_$CONFIG_NAME/feeds/helloworld log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# echo "</details> <details> <summary> Passwall Packages Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# git -C lede_$CONFIG_NAME/feeds/passwall_packages log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# echo "</details> <details> <summary> Passwall Luci Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# git -C lede_$CONFIG_NAME/feeds/passwall_luci log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# echo "</details> <details> <summary> Passwall2 Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# git -C lede_$CONFIG_NAME/feeds/passwall2 log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# # echo "</details> <details> <summary> DockerMan Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# # git -C lede_$CONFIG_NAME/package/lean/luci-app-dockerman log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# # echo "</details> <details> <summary> ThemeArgon Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# # git -C lede_$CONFIG_NAME/package/lean/luci-theme-argon log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# # echo "</details> <details> <summary> ArgonConfig Commit Top $COMMIT_LOG_NUM </summary>" >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# # git -C lede_$CONFIG_NAME/package/lean/luci-app-argon-config log -n $COMMIT_LOG_NUM >> /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# touch /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# echo "status=success" >> $GITHUB_OUTPUT
# has some error
# - name: Upload firmware to release
# uses: softprops/[email protected]
# if: steps.complie.outputs.status == 'success' && steps.tag.outputs.status == 'success' && !cancelled()
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ steps.tag.outputs.release_tag }}
# body_path: /home/$USER/openwrt_releaselog/$CONFIG_NAME/release.txt
# files: /home/$USER/lede_$CONFIG_NAME/bin/targets/*/*
# - name: Delete workflow runs
# uses: GitRML/delete-workflow-runs@main
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# repository: ${{ github.repository }}
# retain_days: 1
# keep_minimum_runs: 2
# - name: Remove old Releases
# uses: smallprogram/[email protected]
# if: env.UPLOAD_RELEASE == 'true' && !cancelled()
# with:
# keep_latest: 15
# delete_tags: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}