Skip to content

Commit 2d14baa

Browse files
committed
adding jira sprint number
1 parent ed78bba commit 2d14baa

File tree

7 files changed

+351
-0
lines changed

7 files changed

+351
-0
lines changed

Gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
source "https://rubygems.org"
3+
4+
gem "fastlane", "2.170.0"
5+
gem "dotenv"
6+
plugins_path = File.join(File.dirname(__FILE__), "fastlane", "Pluginfile")
7+
eval_gemfile(plugins_path) if File.exist?(plugins_path)

Gemfile.lock

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (3.0.3)
5+
addressable (2.7.0)
6+
public_suffix (>= 2.0.2, < 5.0)
7+
atomos (0.1.3)
8+
aws-eventstream (1.1.0)
9+
aws-partitions (1.410.0)
10+
aws-sdk-core (3.110.0)
11+
aws-eventstream (~> 1, >= 1.0.2)
12+
aws-partitions (~> 1, >= 1.239.0)
13+
aws-sigv4 (~> 1.1)
14+
jmespath (~> 1.0)
15+
aws-sdk-kms (1.40.0)
16+
aws-sdk-core (~> 3, >= 3.109.0)
17+
aws-sigv4 (~> 1.1)
18+
aws-sdk-s3 (1.86.2)
19+
aws-sdk-core (~> 3, >= 3.109.0)
20+
aws-sdk-kms (~> 1.26)
21+
aws-sigv4 (~> 1.1)
22+
aws-sigv4 (1.2.2)
23+
aws-eventstream (~> 1, >= 1.0.2)
24+
babosa (1.0.4)
25+
claide (1.0.3)
26+
colored (1.2)
27+
colored2 (3.1.2)
28+
commander-fastlane (4.4.6)
29+
highline (~> 1.7.2)
30+
declarative (0.0.20)
31+
declarative-option (0.1.0)
32+
digest-crc (0.6.3)
33+
rake (>= 12.0.0, < 14.0.0)
34+
domain_name (0.5.20190701)
35+
unf (>= 0.0.5, < 1.0.0)
36+
dotenv (2.7.6)
37+
emoji_regex (3.2.1)
38+
excon (0.78.1)
39+
faraday (1.1.0)
40+
multipart-post (>= 1.2, < 3)
41+
ruby2_keywords
42+
faraday-cookie_jar (0.0.7)
43+
faraday (>= 0.8.0)
44+
http-cookie (~> 1.0.0)
45+
faraday_middleware (1.0.0)
46+
faraday (~> 1.0)
47+
fastimage (2.2.0)
48+
fastlane (2.170.0)
49+
CFPropertyList (>= 2.3, < 4.0.0)
50+
addressable (>= 2.3, < 3.0.0)
51+
aws-sdk-s3 (~> 1.0)
52+
babosa (>= 1.0.3, < 2.0.0)
53+
bundler (>= 1.12.0, < 3.0.0)
54+
colored
55+
commander-fastlane (>= 4.4.6, < 5.0.0)
56+
dotenv (>= 2.1.1, < 3.0.0)
57+
emoji_regex (>= 0.1, < 4.0)
58+
excon (>= 0.71.0, < 1.0.0)
59+
faraday (~> 1.0)
60+
faraday-cookie_jar (~> 0.0.6)
61+
faraday_middleware (~> 1.0)
62+
fastimage (>= 2.1.0, < 3.0.0)
63+
gh_inspector (>= 1.1.2, < 2.0.0)
64+
google-api-client (>= 0.37.0, < 0.39.0)
65+
google-cloud-storage (>= 1.15.0, < 2.0.0)
66+
highline (>= 1.7.2, < 2.0.0)
67+
json (< 3.0.0)
68+
jwt (>= 2.1.0, < 3)
69+
mini_magick (>= 4.9.4, < 5.0.0)
70+
multipart-post (~> 2.0.0)
71+
plist (>= 3.1.0, < 4.0.0)
72+
rubyzip (>= 2.0.0, < 3.0.0)
73+
security (= 0.1.3)
74+
simctl (~> 1.6.3)
75+
slack-notifier (>= 2.0.0, < 3.0.0)
76+
terminal-notifier (>= 2.0.0, < 3.0.0)
77+
terminal-table (>= 1.4.5, < 2.0.0)
78+
tty-screen (>= 0.6.3, < 1.0.0)
79+
tty-spinner (>= 0.8.0, < 1.0.0)
80+
word_wrap (~> 1.0.0)
81+
xcodeproj (>= 1.13.0, < 2.0.0)
82+
xcpretty (~> 0.3.0)
83+
xcpretty-travis-formatter (>= 0.0.3)
84+
fastlane-plugin-json (1.0.0)
85+
fastlane-plugin-load_json (0.0.1)
86+
gh_inspector (1.1.3)
87+
google-api-client (0.38.0)
88+
addressable (~> 2.5, >= 2.5.1)
89+
googleauth (~> 0.9)
90+
httpclient (>= 2.8.1, < 3.0)
91+
mini_mime (~> 1.0)
92+
representable (~> 3.0)
93+
retriable (>= 2.0, < 4.0)
94+
signet (~> 0.12)
95+
google-cloud-core (1.5.0)
96+
google-cloud-env (~> 1.0)
97+
google-cloud-errors (~> 1.0)
98+
google-cloud-env (1.4.0)
99+
faraday (>= 0.17.3, < 2.0)
100+
google-cloud-errors (1.0.1)
101+
google-cloud-storage (1.29.2)
102+
addressable (~> 2.5)
103+
digest-crc (~> 0.4)
104+
google-api-client (~> 0.33)
105+
google-cloud-core (~> 1.2)
106+
googleauth (~> 0.9)
107+
mini_mime (~> 1.0)
108+
googleauth (0.14.0)
109+
faraday (>= 0.17.3, < 2.0)
110+
jwt (>= 1.4, < 3.0)
111+
memoist (~> 0.16)
112+
multi_json (~> 1.11)
113+
os (>= 0.9, < 2.0)
114+
signet (~> 0.14)
115+
highline (1.7.10)
116+
http-cookie (1.0.3)
117+
domain_name (~> 0.5)
118+
httpclient (2.8.3)
119+
jmespath (1.4.0)
120+
json (2.4.1)
121+
jwt (2.2.2)
122+
memoist (0.16.2)
123+
mini_magick (4.11.0)
124+
mini_mime (1.0.2)
125+
multi_json (1.15.0)
126+
multipart-post (2.0.0)
127+
nanaimo (0.3.0)
128+
naturally (2.2.0)
129+
os (1.1.1)
130+
plist (3.5.0)
131+
public_suffix (4.0.6)
132+
rake (13.0.2)
133+
representable (3.0.4)
134+
declarative (< 0.1.0)
135+
declarative-option (< 0.2.0)
136+
uber (< 0.2.0)
137+
retriable (3.1.2)
138+
rouge (2.0.7)
139+
ruby2_keywords (0.0.2)
140+
rubyzip (2.3.0)
141+
security (0.1.3)
142+
signet (0.14.0)
143+
addressable (~> 2.3)
144+
faraday (>= 0.17.3, < 2.0)
145+
jwt (>= 1.5, < 3.0)
146+
multi_json (~> 1.10)
147+
simctl (1.6.8)
148+
CFPropertyList
149+
naturally
150+
slack-notifier (2.3.2)
151+
terminal-notifier (2.0.0)
152+
terminal-table (1.8.0)
153+
unicode-display_width (~> 1.1, >= 1.1.1)
154+
tty-cursor (0.7.1)
155+
tty-screen (0.8.1)
156+
tty-spinner (0.9.3)
157+
tty-cursor (~> 0.7)
158+
uber (0.1.0)
159+
unf (0.1.4)
160+
unf_ext
161+
unf_ext (0.0.7.7)
162+
unicode-display_width (1.7.0)
163+
word_wrap (1.0.0)
164+
xcodeproj (1.19.0)
165+
CFPropertyList (>= 2.3.3, < 4.0)
166+
atomos (~> 0.1.3)
167+
claide (>= 1.0.2, < 2.0)
168+
colored2 (~> 3.1)
169+
nanaimo (~> 0.3.0)
170+
xcpretty (0.3.0)
171+
rouge (~> 2.0.7)
172+
xcpretty-travis-formatter (1.0.0)
173+
xcpretty (~> 0.2, >= 0.0.7)
174+
175+
PLATFORMS
176+
ruby
177+
178+
DEPENDENCIES
179+
dotenv
180+
fastlane (= 2.170.0)
181+
fastlane-plugin-json
182+
fastlane-plugin-load_json
183+
184+
BUNDLED WITH
185+
1.17.2

fastlane/Fastfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
require "net/http"
3+
require "openssl"
4+
require "json"
5+
fastlane_require "dotenv"
6+
7+
before_all do |lane, options|
8+
ENV["JIRA_USER"] = "[email protected]"
9+
ENV["JIRA_API_TOKEN"] = "Z8bj30qCy9uRzOaGG3mWB1ED"
10+
end
11+
12+
def get_active_jira_sprint
13+
uri = URI("https://colucom.atlassian.net/rest/agile/1.0/board/54/sprint?state=active&maxResults=1")
14+
Net::HTTP.start(uri.host, uri.port,
15+
use_ssl: uri.scheme == "https",
16+
verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
17+
request = Net::HTTP::Get.new uri.request_uri
18+
request.basic_auth ENV["JIRA_USER"], ENV["JIRA_API_TOKEN"]
19+
response = http.request request # Net::HTTPResponse object
20+
json = JSON.parse(response.body)
21+
sprint_name = json["values"][0]["name"].gsub(/Sprint\s/, "")
22+
return sprint_name
23+
end
24+
end
25+
26+
lane :print_sprint do
27+
package_json = read_json(json_path: "package.json")
28+
sem_ver = package_json[:version]
29+
major, minor = sem_ver.split(".")
30+
jira_active_sprint_number = get_active_jira_sprint
31+
if jira_active_sprint_number > minor
32+
updated_version = "#{major}.#{jira_active_sprint_number}.0"
33+
puts "LET'S BUMP VERSION(#{sem_ver}) TO BE CURRENT WITH JIRA'S SPRINT(#{updated_version})"
34+
sh(" npm version #{updated_version} --no-git-tag-version")
35+
else
36+
puts "NO MINOR VERSION CHANGE NECESSARY"
37+
end
38+
end

fastlane/Pluginfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Autogenerated by fastlane
2+
#
3+
# Ensure this file is checked in to source control!
4+
5+
gem 'fastlane-plugin-json'
6+
gem 'fastlane-plugin-load_json'

fastlane/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
fastlane documentation
2+
================
3+
# Installation
4+
5+
Make sure you have the latest version of the Xcode command line tools installed:
6+
7+
```
8+
xcode-select --install
9+
```
10+
11+
Install _fastlane_ using
12+
```
13+
[sudo] gem install fastlane -NV
14+
```
15+
or alternatively using `brew install fastlane`
16+
17+
# Available Actions
18+
### print_sprint
19+
```
20+
fastlane print_sprint
21+
```
22+
23+
24+
----
25+
26+
This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run.
27+
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
28+
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).

jira.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const simpleGit = require('simple-git');
2+
const git = simpleGit();

jira.sh

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/sh
2+
3+
4+
# uri = URI("https://colucom.atlassian.net/rest/agile/1.0/board/54/sprint?state=active&maxResults=1")
5+
# JIRA_USER="[email protected]"
6+
# JIRA_API_TOKEN="Z8bj30qCy9uRzOaGG3mWB1ED"
7+
8+
9+
admin_user="[email protected]"
10+
api_token="admZ8bj30qCy9uRzOaGG3mWB1EDin"
11+
12+
user="tomd"
13+
url="https://colucom.atlassian.net/rest/agile/1.0/board/54/sprint?state=active&maxResults=1"
14+
15+
# curl -s -u "${admin_user}:${admin_password}" ${url}
16+
17+
# curl -u username:password -i -H 'Accept:application/json' http://example.com
18+
19+
20+
# response=$(curl -u "${admin_user}:${admin_password}" -X GET -H "Content-Type: application/json" ${url})
21+
22+
base64_string="eWVodWRhQGNvbHUuY29tOmFkbVo4YmozMHFDeTl1UnpPYUdHM21XQjFFRGlu"
23+
24+
# response=$(curl -H "Authorization: Basic ${base64_string}" -X GET -H "Content-Type: application/json" ${url})
25+
26+
curl -v ${url} --user "${admin_user}:${api_token}"
27+
28+
# response2=$(curl -u "${admin_user}:${api_token}" -i \
29+
# -H 'Accept:application/json' \
30+
# -H 'Authorization:Basic ${base64_string}' \
31+
# ${url})
32+
33+
# echo $response
34+
35+
36+
# export JIRA='login:password'
37+
# export JIRA_API=https://example.com/jira/rest/api/2
38+
# export JIRA_CERT=/full/path/to/certificate/file
39+
# export JIRA_KEY=/full/path/to/private/key/file
40+
# export JIRA_CA=/full/path/to/certificate/authority/file
41+
42+
# function jiraApi() {
43+
# DATA_PARAM='-'
44+
45+
# if [[ PUT == ${1} || POST == ${1} ]]
46+
# then
47+
# DATA_PARAM='@-'
48+
# fi
49+
50+
# if [[ -z ${3} ]]
51+
# then
52+
# curl --user "${JIRA}" \
53+
# --cert "${JIRA_CERT}" \
54+
# --key "${JIRA_KEY}" \
55+
# --cacert "${JIRA_CA}" \
56+
# --header 'Content-Type: application/json' \
57+
# --request "${1}" \
58+
# --data "${DATA_PARAM}" \
59+
# --silent \
60+
# "${JIRA_API}/${2}"
61+
# else
62+
# echo "${3}" |
63+
# curl --user "${JIRA}" \
64+
# --cert "${JIRA_CERT}" \
65+
# --key "${JIRA_KEY}" \
66+
# --cacert "${JIRA_CA}" \
67+
# --header 'Content-Type: application/json' \
68+
# --request "${1}" \
69+
# --data "${DATA_PARAM}" \
70+
# --silent \
71+
# "${JIRA_API}/${2}"
72+
# fi
73+
# }
74+
75+
# function jiraGet() {
76+
# jiraApi GET "${@}"
77+
# }
78+
79+
# function jiraPost() {
80+
# jiraApi POST "${@}"
81+
# }
82+
83+
# function jiraPut() {
84+
# jiraApi PUT "${@}"
85+
# }

0 commit comments

Comments
 (0)