mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-27 04:21:11 +00:00
[GITEA] Allow release creation on commit
- The code and tests are already there to allow releases to be created on commits. - This patch modifies the web code to take into account that an commitID could've been passed as target. - Added unit test. - Resolves https://codeberg.org/forgejo/forgejo/issues/1196 (cherry picked from commit90863e0ab5) (cherry picked from commitc805aa23b5) (cherry picked from commitcf45567ca6) (cherry picked from commit672a2b91e5) (cherry picked from commit82c930152c) (cherry picked from commit95ac2508b3) (cherry picked from commitb13a81ab98) (cherry picked from commit9f463a7c1f) (cherry picked from commit758ce84dc5) Conflicts: tests/integration/release_test.go https://codeberg.org/forgejo/forgejo/pulls/1550 (cherry picked from commitedf0531aee) (cherry picked from commit44b29f3a1d) (cherry picked from commitb851b67419) (cherry picked from commit59c22547d7)
This commit is contained in:
parent
4c017d931b
commit
1eae28475b
2 changed files with 17 additions and 2 deletions
|
|
@ -21,6 +21,10 @@ import (
|
|||
)
|
||||
|
||||
func createNewRelease(t *testing.T, session *TestSession, repoURL, tag, title string, preRelease, draft bool) {
|
||||
createNewReleaseTarget(t, session, repoURL, tag, title, "master", preRelease, draft)
|
||||
}
|
||||
|
||||
func createNewReleaseTarget(t *testing.T, session *TestSession, repoURL, tag, title, target string, preRelease, draft bool) {
|
||||
req := NewRequest(t, "GET", repoURL+"/releases/new")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
|
@ -31,7 +35,7 @@ func createNewRelease(t *testing.T, session *TestSession, repoURL, tag, title st
|
|||
postData := map[string]string{
|
||||
"_csrf": htmlDoc.GetCSRF(),
|
||||
"tag_name": tag,
|
||||
"tag_target": "master",
|
||||
"tag_target": target,
|
||||
"title": title,
|
||||
"content": "",
|
||||
}
|
||||
|
|
@ -217,6 +221,15 @@ func TestViewReleaseListLogin(t *testing.T) {
|
|||
}, links)
|
||||
}
|
||||
|
||||
func TestReleaseOnCommit(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
createNewReleaseTarget(t, session, "/user2/repo1", "v0.0.1", "v0.0.1", "65f1bf27bc3bf70f64657658635e66094edbcb4d", false, false)
|
||||
|
||||
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.1", translation.NewLocale("en-US").Tr("repo.release.stable"), 4)
|
||||
}
|
||||
|
||||
func TestViewTagsList(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue