Compare commits
26 Commits
@@ -6,22 +6,43 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
env:
|
||||||
|
XMAKE_BINARY_REPO: https://gitee.com/xmake-mirror/build-artifacts.git
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: https://github.bibk.top/actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup XMake
|
- name: Setup XMake
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
uses: https://git.soulmc.cn/wed15/github-action-setup-xmake@v1
|
||||||
|
|
||||||
- name: Cache
|
- name: Cache
|
||||||
uses: actions/cache@v4
|
uses: https://github.bibk.top/actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/AppData/Local/.xmake
|
~/AppData/Local/.xmake
|
||||||
key: xmake-${{ hashFiles('xmake.lua') }}
|
key: xmake-${{ hashFiles('xmake.lua') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
xmake-
|
xmake-
|
||||||
|
|
||||||
|
- name: Configure Mirror
|
||||||
|
run: |
|
||||||
|
$fileName = "github_mirror.lua"
|
||||||
|
$currentDir = Get-Location
|
||||||
|
$absoluteFilePath = Join-Path $currentDir $fileName
|
||||||
|
$luaContent = @'
|
||||||
|
function mirror(url)
|
||||||
|
url = url:gsub("github.com", "github.bibk.top")
|
||||||
|
return url
|
||||||
|
end
|
||||||
|
function main(url, host)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
'@
|
||||||
|
$luaContent | Out-File -FilePath $absoluteFilePath -Encoding utf8
|
||||||
|
Write-Host "Mirror config generated at: $absoluteFilePath"
|
||||||
|
xmake g --proxy_pac=$absoluteFilePath
|
||||||
|
shell: powershell
|
||||||
|
|
||||||
- name: Update Repo
|
- name: Update Repo
|
||||||
run: xmake repo -u
|
run: xmake repo -u
|
||||||
|
|
||||||
@@ -32,8 +53,7 @@ jobs:
|
|||||||
run: xmake -v -y
|
run: xmake -v -y
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: https://github.bibk.top/actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||||
path: |
|
path: bin/
|
||||||
bin/
|
|
||||||
@@ -2,19 +2,21 @@ on:
|
|||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
env:
|
||||||
|
XMAKE_BINARY_REPO: https://gitee.com/xmake-mirror/build-artifacts.git
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: https://github.bibk.top/actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup XMake
|
- name: Setup XMake
|
||||||
uses: xmake-io/github-action-setup-xmake@v1
|
uses: https://git.soulmc.cn/wed15/github-action-setup-xmake@v1
|
||||||
|
|
||||||
- name: Cache
|
- name: Cache
|
||||||
uses: actions/cache@v4
|
uses: https://github.bibk.top/actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/AppData/Local/.xmake
|
~/AppData/Local/.xmake
|
||||||
@@ -22,6 +24,25 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
xmake-
|
xmake-
|
||||||
|
|
||||||
|
- name: Configure Mirror
|
||||||
|
run: |
|
||||||
|
$fileName = "github_mirror.lua"
|
||||||
|
$currentDir = Get-Location
|
||||||
|
$absoluteFilePath = Join-Path $currentDir $fileName
|
||||||
|
$luaContent = @'
|
||||||
|
function mirror(url)
|
||||||
|
url = url:gsub("github.com", "github.bibk.top")
|
||||||
|
return url
|
||||||
|
end
|
||||||
|
function main(url, host)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
'@
|
||||||
|
$luaContent | Out-File -FilePath $absoluteFilePath -Encoding utf8
|
||||||
|
Write-Host "Mirror config generated at: $absoluteFilePath"
|
||||||
|
xmake g --proxy_pac=$absoluteFilePath
|
||||||
|
shell: powershell
|
||||||
|
|
||||||
- name: Update Repo
|
- name: Update Repo
|
||||||
run: xmake repo -u
|
run: xmake repo -u
|
||||||
|
|
||||||
@@ -32,7 +53,7 @@ jobs:
|
|||||||
run: xmake -v -y
|
run: xmake -v -y
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: https://github.bibk.top/actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||||
path: |
|
path: |
|
||||||
@@ -46,10 +67,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: https://github.bibk.top/actions/checkout@v4
|
||||||
|
|
||||||
- name: Download Artifact
|
- name: Download Artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: https://github.bibk.top/actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
|
||||||
path: artifact
|
path: artifact
|
||||||
@@ -64,7 +85,7 @@ jobs:
|
|||||||
working-directory: artifact
|
working-directory: artifact
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: https://github.bibk.top/softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
${{ github.event.repository.name }}-windows-x64.zip
|
${{ github.event.repository.name }}-windows-x64.zip
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 1. 定义文件名
|
||||||
|
$fileName = "github_mirror.lua"
|
||||||
|
|
||||||
|
# 2. 获取当前工作目录的绝对路径 (例如: D:\a\your-repo\your-repo)
|
||||||
|
$currentDir = Get-Location
|
||||||
|
|
||||||
|
# 3. 拼接出绝对文件路径 (例如: D:\a\your-re_repo\your-repo\github_mirror.lua)
|
||||||
|
$absoluteFilePath = Join-Path $currentDir $fileName
|
||||||
|
|
||||||
|
# 4. 定义 Lua 脚本内容
|
||||||
|
$luaContent = @'
|
||||||
|
function mirror(url)
|
||||||
|
-- 强制将 github.com 替换为镜像域名
|
||||||
|
url = url:gsub("github.com", "github.bibk.top")
|
||||||
|
return url
|
||||||
|
end
|
||||||
|
|
||||||
|
-- main 函数允许处理该 URL
|
||||||
|
function main(url, host)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
'@
|
||||||
|
|
||||||
|
# 5. 使用绝对路径写入文件
|
||||||
|
$luaContent | Out-File -FilePath $absoluteFilePath -Encoding utf8
|
||||||
|
|
||||||
|
# 6. 输出调试信息 (可选,确认路径是否正确)
|
||||||
|
Write-Host "Mirror config generated at: $absoluteFilePath"
|
||||||
|
|
||||||
|
# 7. 配置 Xmake 使用该绝对路径的配置文件
|
||||||
|
xmake g --proxy_pac=$absoluteFilePath
|
||||||
Reference in New Issue
Block a user