Replace actions/checkout with instance git clone (github.com unreachable from runner)
build-and-release / build (push) Successful in 4s
build-and-release / build (push) Successful in 4s
This commit is contained in:
@@ -26,7 +26,19 @@ Gitea Actions 自托管 runner 的测试仓库,同时作为其他仓库编写
|
||||
- 默认 shell 是 PowerShell,写 run 步骤时用 PowerShell 语法,
|
||||
或显式声明 shell: pwsh;不要写 bash 语法
|
||||
- 路径用 Windows 规则;产物打包用 Compress-Archive
|
||||
- actions/checkout@v4 等 GitHub 官方 action 可用(runner 可访问 github.com 和 npm/pypi registry)
|
||||
- runner 到 github.com 的网络不稳定,【禁止使用 actions/checkout@v4 等托管在 github.com 的 action】,
|
||||
拉代码必须用下面的实例克隆步骤(npm/pypi registry 可正常访问)
|
||||
|
||||
【拉取代码(代替 actions/checkout,shell: pwsh)】
|
||||
|
||||
- name: Checkout
|
||||
shell: pwsh
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
$url = "${{ gitea.server_url }}/${{ github.repository }}.git" -replace '^https://', "https://x-access-token:$env:GITEA_TOKEN@"
|
||||
git clone $url .
|
||||
git checkout ${{ github.sha }}
|
||||
|
||||
【Release 发布方式】
|
||||
用 Gitea API 发布,token 用自动注入的 ${{ secrets.GITHUB_TOKEN }},
|
||||
|
||||
Reference in New Issue
Block a user