Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
3f6fc9a9
Commit
3f6fc9a9
authored
4 years ago
by
Stéphane Veyret
Committed by
Éloïs
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Publish links to the release binaries
Closes
#1411
parent
42e65cac
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1310
Publish links to the release binaries
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab/releaser/releaselinks.py
+28
-0
28 additions, 0 deletions
.gitlab/releaser/releaselinks.py
.gitlab/releaser/releaser.py
+8
-1
8 additions, 1 deletion
.gitlab/releaser/releaser.py
with
36 additions
and
1 deletion
.gitlab/releaser/releaselinks.py
0 → 100644
+
28
−
0
View file @
3f6fc9a9
import
json
import
os
import
urllib.request
from
projectapi
import
ProjectApi
class
ReleaseLinks
(
ProjectApi
):
'''
Release links API.
'''
def
__init__
(
self
):
ProjectApi
.
__init__
(
self
,
'
/releases/{}/assets/links
'
.
format
(
os
.
environ
[
'
CI_COMMIT_TAG
'
]))
def
create_artifact
(
self
,
artifact
):
'''
Create the link for the given artifact.
:param artifact: The artifact data.
:type artifact: dict
'''
send_data
=
{
'
name
'
:
'
{} {} - {}
'
.
format
(
artifact
[
'
category
'
],
artifact
[
'
arch
'
],
artifact
[
'
type
'
]),
'
filepath
'
:
'
/binaries/{}
'
.
format
(
artifact
[
'
name
'
]),
'
url
'
:
artifact
[
'
url
'
]
}
send_data_serialized
=
json
.
dumps
(
send_data
).
encode
(
'
utf-8
'
)
request
=
self
.
build_request
(
data
=
send_data_serialized
,
method
=
'
POST
'
)
request
.
add_header
(
'
Content-Type
'
,
'
application/json
'
)
urllib
.
request
.
urlopen
(
request
)
This diff is collapsed.
Click to expand it.
.gitlab/releaser/releaser.py
+
8
−
1
View file @
3f6fc9a9
...
...
@@ -6,6 +6,7 @@ import os
from
binartifact
import
BinArtifact
from
job
import
Job
from
placeholder
import
PlaceHolder
from
releaselinks
import
ReleaseLinks
from
releasenote
import
ReleaseNote
from
releasewikipage
import
ReleaseWikiPage
from
sourceartifact
import
SourceArtifact
...
...
@@ -48,9 +49,11 @@ class Releaser:
releaseNote
=
ReleaseNote
()
current_message
=
releaseNote
.
get_message
()
artifacts_list
=
[]
binArtifacts
=
self
.
_get_bin_artifacts
()
releaseLinks
=
ReleaseLinks
()
# Get releases
artifacts_list
+=
self
.
_get_
bin
_a
rtifacts
()
artifacts_list
+=
bin
A
rtifacts
artifacts_list
.
sort
()
artifacts_list
+=
list
(
map
(
lambda
e
:
SourceArtifact
(
e
),
self
.
source_ext
))
...
...
@@ -65,6 +68,10 @@ class Releaser:
})
releaseNote
.
send_note
(
title_line
+
note
)
# Publish binaries as links
for
binArtifact
in
binArtifacts
:
releaseLinks
.
create_artifact
(
binArtifact
.
to_dict
())
print
(
'
Pre-release published
'
)
def
publish_release
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment