Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix autoupdate #3070

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
- uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
actions-cache-folder: '.xmake-cache'

- name: Installation
run: |
Expand Down
10 changes: 6 additions & 4 deletions scripts/autoupdate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ end

function _is_pending(instance, version)
local branch = "autoupdate-" .. instance:name() .. "-" .. version
local repourl = "https://github.com/xmake-io/xmake-repo.git"
local repourl = "git@github.com:xmake-io/xmake-repo.git"
local is_pending = false
local remote_branches = os.iorun("git ls-remote --head %s", repourl)
if remote_branches then
Expand All @@ -57,8 +57,9 @@ end
function _update_version(instance, version, shasum)
local branch = "autoupdate-" .. instance:name() .. "-" .. version
local branch_current = os.iorun("git branch --show-current"):trim()
local repourl = "https://github.com/xmake-io/xmake-repo.git"
local repourl = "git@github.com:xmake-io/xmake-repo.git"
os.vexec("git reset --hard HEAD")
os.vexec("git clean -fdx")
os.execv("git", {"branch", "-D", branch}, {try = true})
os.vexec("git checkout dev")
os.vexec("git pull %s dev", repourl)
Expand All @@ -69,7 +70,7 @@ function _update_version(instance, version, shasum)
local inserted = false
local version_current
io.gsub(scriptfile, "add_versions%(\"(.-)\",%s+\"(.-)\"%)", function (v, h)
if not version_current or sermver.compare(v, version_current) > 0 then
if not version_current or semver.compare(v, version_current) > 0 then
version_current = v
end
if not inserted then
Expand All @@ -82,7 +83,8 @@ function _update_version(instance, version, shasum)
os.vexec("git add .")
os.vexec("git commit -a -m \"Update %s to %s\"", instance:name(), version)
os.vexec("git push %s %s:%s", repourl, branch, branch)
os.vexec("gh pr create --title \"Auto-update %s to %s\" --body \"%s\" -R xmake-io/xmake-repo -B dev -H %s", instance:name(), version, body, branch)
os.vexec("gh pr create --label \"auto-update\" --title \"Auto-update %s to %s\" --body \"%s\" -R xmake-io/xmake-repo -B dev -H %s",
instance:name(), version, body, branch)
end
os.vexec("git reset --hard HEAD")
os.vexec("git checkout %s", branch_current)
Expand Down
Loading