summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-01-11 14:24:20 +0900
committerShinya Maeda <shinya@gitlab.com>2019-01-11 14:24:20 +0900
commitb26db14d62cfbbe11d0e84630a5809c6ac67656a (patch)
treeb268002210822811148e2e976b7833a7dd062f53
parent89c4d2ae623dbd666e2eaa58812323b81e02b4ea (diff)
downloadgitlab-ce-create-release-entry-in-pipeline.tar.gz
Create release entry in pipelinecreate-release-entry-in-pipeline
-rw-r--r--.gitlab-ci.yml16
-rw-r--r--scripts/create_release.rb41
2 files changed, 57 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 45de5ce61c6..eefbfc7ceb2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -52,6 +52,7 @@ stages:
- test
- post-test
- pages
+ - release
- post-cleanup
# Predefined scopes
@@ -879,6 +880,21 @@ pages:
- master@gitlab-org/gitlab-ce
- master@gitlab-org/gitlab-ee
+##
+# Create a release note
+# You can check it in https://gitlab.com/gitlab-org/gitlab-ce/releases
+release:
+ <<: *dedicated-no-docs-no-db-pull-cache-job
+ before_script: []
+ stage: release
+ script:
+ - ./scripts/create_release.rb
+ only:
+ refs:
+ - tags@gitlab-org/gitlab-ce
+ variables:
+ - $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+\$/
+
# Insurance in case a gem needed by one of our releases gets yanked from
# rubygems.org in the future.
cache gems:
diff --git a/scripts/create_release.rb b/scripts/create_release.rb
new file mode 100644
index 00000000000..29dfe0a2bb4
--- /dev/null
+++ b/scripts/create_release.rb
@@ -0,0 +1,41 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+class Release
+ attr_reader :edition, :tag
+
+ def initialize(edition, tag)
+ @edition = edition
+ @tag = tag
+ end
+
+ def valid?
+ /^$/.match(tag) && /^$/.match(previous_tag)
+ end
+
+ def create
+ return unless valied?
+
+ # curl --header 'Content-Type: application/json' \
+ # --header "PRIVATE-TOKEN: $GITLAB_RELEASE_API_TOKEN" \
+ # --data '{ "name": "${name}", "tag_name": "${tag_name}", "description": "${changelog}" }' \
+ # --request POST \
+ # http://gitlab.com/api/v4/projects/$CI_PROJECT_ID/releases
+ end
+
+ private
+
+ def previous_release
+
+ end
+
+ def changelog_path
+ './CHANGELOG.md'
+ end
+
+ def changelog_diff
+
+ end
+end
+
+Release.new("CE", ENV['CI_COMMIT_TAG']).create