-
Notifications
You must be signed in to change notification settings - Fork 113
152 lines (131 loc) · 5.07 KB
/
defconfig.yml
File metadata and controls
152 lines (131 loc) · 5.07 KB
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
#
# Copyright (c) 2022-2024 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: defconfig
on:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'
is_copy_seeds:
description: 'Do you want to copy the seed?'
required: false
default: 'false'
# schedule:
# - cron: 0 */8 * * *
env:
MAKE_DEFCONFIG_SH: compile_script/step01_make_defconfig.sh
GENERATE_RELEASE_TAG_SH: compile_script/step02_generate_release_tag.sh
GENERATE_GIT_LOG_SH: compile_script/step03_generate_git_log.sh
UPDATE_GIT_LOG_SH: compile_script/step06_update_git_log.sh
ORGANIZE_TAG_SH: compile_script/step07_organize_tag.sh
PLATFORMS_SH: compile_script/platforms.sh
UPLOAD_BIN_DIR: false
UPLOAD_FIRMWARE: true
UPLOAD_ARTIFACT: true
UPLOAD_RELEASE: true
TZ: Asia/Shanghai
jobs:
job_init:
runs-on: ubuntu-latest
name: Init
outputs:
output_release_tag: ${{ steps.gen_release_tag.outputs.release_tag }}
platforms: ${{ steps.read-platforms.outputs.matrix }}
platforms_source: ${{ steps.read-platforms.outputs.source_matrix_json }}
steps:
- name: Generate Tag Name
id: gen_release_tag
run: |
echo "release_tag=multi-platform_$(date +"%Y.%m.%d_%H.%M.%S")" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Read Platforms From File
id: read-platforms
run: |
bash $PLATFORMS_SH
job_source_init:
needs: job_init
runs-on: ${{ matrix.value.OS }}
name: Source-Init-${{ matrix.source_code_platform }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.job_init.outputs.platforms_source) }}
steps:
- name: Init System
id: init
run: |
sudo timedatectl set-timezone "$TZ"
sudo mkdir -p /workdir
sudo chown -R $USER:$GROUPS /workdir
cd /workdir
sudo mkdir -p output
sudo chown -R $USER:$GROUPS /workdir/output
ln -sf /workdir/output $GITHUB_WORKSPACE/output
df -hT
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Clone Source Code
working-directory: /workdir
run: |
git clone -b ${{matrix.value.REPO_BRANCH}} --single-branch ${{ matrix.value.REPO_URL }} openwrt
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
- name: Load Custom Feeds
run: |
# [ -e $FEEDS_CONF ] && cp -r ${{ matrix.value.FEEDS_CONF }} openwrt/feeds.conf.default
chmod +x ${{ matrix.value.DIY_P1_SH }}
cd openwrt
$GITHUB_WORKSPACE/${{ matrix.value.DIY_P1_SH }}
- name: Update Feeds
run: cd openwrt && ./scripts/feeds update -a
- name: Install Feeds
run: cd openwrt && ./scripts/feeds install -a
- name: Pull the latest changes and Create temporary branch
run: |
git fetch origin
git reset --hard origin/${{ github.ref_name }}
git checkout -b temp-${{ matrix.source_code_platform }}
- name: Make Defconfig Custom Configuration
run: |
chmod +x ${{ matrix.value.DIY_P2_SH }}
chmod +x $MAKE_DEFCONFIG_SH
cd openwrt
$GITHUB_WORKSPACE/${{ matrix.value.DIY_P2_SH }}
$GITHUB_WORKSPACE/$MAKE_DEFCONFIG_SH "${{ matrix.source_code_platform }}" "${{ matrix.value.CONFIGS }}" "${{ github.event.inputs.is_copy_seeds }}"
- name: Merge and push changes with "theirs" strategy
run: |
git checkout temp-${{ matrix.source_code_platform }}
git add .
if ! git diff --cached --quiet; then
git config user.name "smallprogram"
git config user.email "smallprogram@foxmail.com"
git commit -m "Auto update for ${{ matrix.source_code_platform }} configuration"
git checkout ${{ github.ref_name }}
git fetch origin
git reset --hard origin/${{ github.ref_name }}
git checkout temp-${{ matrix.source_code_platform }}
git merge origin/${{ github.ref_name }} --no-ff --strategy-option theirs --no-edit || {
echo "Merge conflict in temp branch, please resolve manually."
exit 100
}
git checkout ${{ github.ref_name }}
git merge temp-${{ matrix.source_code_platform }} --strategy-option theirs --no-edit
git push origin ${{ github.ref_name }} --force
git branch -d temp-${{ matrix.source_code_platform }} || echo "Local temp-${{ matrix.source_code_platform }} not found"
git push origin --delete temp-${{ matrix.source_code_platform }} || echo "Remote temp-${{ matrix.source_code_platform }} not found"
else
echo "No changes to commit."
fi