-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (134 loc) · 5.87 KB
/
make.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
name: MSUpdate
run-name: Make MSUpdate ${{ inputs.makeversion }} by @${{ github.actor }} ${{ inputs.UpdateFromUUP == true && '- UUP' || '' }} ${{ inputs.MultiEdition == true && '- Multi' || ''}} ${{ inputs.SkipCheck == true && '- SkipCheck' || ''}}
on:
workflow_dispatch:
inputs:
makeversion:
description: '选择制作的系统版本'
required: true
type: choice
options:
- w1124h264
- w1124h2a64
- w1123h264
- w1123h2a64
- w1022h264
- w1022h2a64
- w1022h232
- w11lt2464
- w11lt24a64
- w10lt2164
- w10lt2132
- w10lt1964
- w10lt1932
- w10lt1664
- w10lt1632
UpdateFromUUP:
description: '从UUPDUMP获取更新(1809+)'
required: false
default: true
type: boolean
MultiEdition:
description: '转换多版本(LTSC勿选)'
required: false
default: true
type: boolean
SkipCheck:
description: '跳过硬件检测(Win11)'
required: false
default: false
type: boolean
jobs:
msupdate:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Change DNS Server
shell: pwsh
run: |
$newDnsServers = @('1.1.1.1', '8.8.8.8')
$networkAdapters = Get-NetAdapter | Where-Object { $_.Status -eq 'Up' }
foreach ($adapter in $networkAdapters) {
Set-DnsClientServerAddress -InterfaceIndex $adapter.ifIndex -ResetServerAddresses
Set-DnsClientServerAddress -InterfaceIndex $adapter.ifIndex -ServerAddresses $newDnsServers
}
ipconfig /flushdns
# - name: Install Cloudflare WRAP
# shell: pwsh
# run: |
# Write-Host "installing Cloudflare WARP..."
# Invoke-WebRequest -Uri "https://1111-releases.cloudflareclient.com/win/latest" -OutFile "C:\cfwarp.msi"
# Start-Process "msiexec.exe" -ArgumentList "/i C:\cfwarp.msi /qn" -Wait
# . "C:\Program Files\Cloudflare\Cloudflare WARP\warp-cli.exe" registration new
# . "C:\Program Files\Cloudflare\Cloudflare WARP\warp-cli.exe" connect
# # Add a loop to wait for the status to be connected
# for ($attemptCount = 0; $attemptCount -lt 10; $attemptCount++) {
# $output = . "C:\Program Files\Cloudflare\Cloudflare WARP\warp-cli.exe" status
# Write-Host $output
# if ($output -like "*Status update: Connected*") {
# break
# }
# Start-Sleep -Seconds 5 # Wait for 5 seconds before checking again
# }
# if ($attemptCount -eq 10) {
# Write-Host "Failed to connect after 10 attempts."
# exit 1 # Exit with an error code
# }
- name: Big Task
shell: pwsh
run: |
$MakeVersion = [string] "${{ inputs.MakeVersion }}"
$UpdateFromUUP = [bool] $${{ inputs.UpdateFromUUP }}
$MultiEdition = [bool] $${{ inputs.MultiEdition }}
$SkipCheck = [bool] $${{ inputs.SkipCheck }}
.\msupdate.ps1
# - name: Disconnect Cloudflare WRAP
# shell: pwsh
# run: |
# if (Test-Path "C:\Program Files\Cloudflare\Cloudflare WARP\warp-cli.exe") {
# try {
# . "C:\Program Files\Cloudflare\Cloudflare WARP\warp-cli.exe" disconnect
# }
# catch {
# Write-Warning "Failed to disconnect Cloudflare WARP"
# }
# }
- name: Get rclone Config
uses: actions/checkout@v4
with:
repository: ${{ vars.RCLONE_REPO }}
token: ${{ secrets.RCLONE_TOKEN }}
path: bin
- name: Upload ISO to OneDrive
shell: pwsh
run: |
# Installing dependencies
if (-not (Test-Path -Path ".\bin\rclone.conf")) {
Write-Error "rclone conf not found"
}
if (-not (Test-Path -Path ".\bin\rclone.exe")) {
Write-Host "rclone not found, downloading..."
Invoke-WebRequest -Uri 'https://downloads.rclone.org/rclone-current-windows-amd64.zip' -outfile .\temp\rclone.zip
Expand-Archive -Path .\temp\rclone.zip -DestinationPath .\temp\ -Force
Copy-Item -Path .\temp\rclone-*-windows-amd64\rclone.exe -Destination .\bin\rclone.exe
}
# upload to cloud
Get-ChildItem -Path ".\*.json" -File | ForEach-Object {
# read json
$json = Get-Content $_.FullName | Convertfrom-Json
if (-not (Test-Path ".\$($json.name)")) {
throw "File not found!"
}
# upload iso
Write-Host "Uploading $(Resolve-Path $json.name) to ${{ vars.RCLONE_PATH }}\$($json.os_ver)\$($json.os_release)\$($json.os_version)..."
.\bin\rclone.exe copy "$(Resolve-Path $json.name)" "${{ vars.RCLONE_PATH }}\$($json.os_ver)\$($json.os_release)\$($json.os_version)" --progress
# upload json
Write-Host "Uploading $(Resolve-Path $_.FullName) to ${{ vars.RCLONE_PATH }}\$($json.os_ver)\$($json.os_release)\$($json.os_version)..."
.\bin\rclone.exe copy "$(Resolve-Path $_.FullName)" "${{ vars.RCLONE_PATH }}\$($json.os_ver)\$($json.os_release)\$($json.os_version)" --progress
# upload non-skipcheck latest version json
if ($json.msupdate.skipcheck -ne $true) {
Write-Host "Uploading $(Resolve-Path $_.FullName) to ${{ vars.RCLONE_PATH }}\$($json.os_ver)\$($json.os_release)\latest_$($json.os_arch).json..."
.\bin\rclone.exe copyto "$(Resolve-Path $_.FullName)" "${{ vars.RCLONE_PATH }}\$($json.os_ver)\$($json.os_release)\latest_$($json.os_arch).json" --progress
}
}