zilkey-auto_tagger 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +52 -5
- data/bin/autotag +8 -4
- metadata +1 -1
data/README.md
CHANGED
@@ -65,22 +65,69 @@ Example `config/deploy.rb` file:
|
|
65
65
|
# You need to add the before/ater callbacks yourself
|
66
66
|
before "deploy:update_code", "release_tagger:set_branch"
|
67
67
|
after "deploy", "release_tagger:create_tag"
|
68
|
+
after "deploy", "release_tagger:write_tag_to_shared"
|
69
|
+
after "deploy", "release_tagger:print_latest_tags"
|
68
70
|
|
69
|
-
|
71
|
+
### `release_tagger:set_branch`
|
72
|
+
|
73
|
+
This task sets the git branch to the latest tag from the previous stage. Assume you have the following tags in your git repository:
|
70
74
|
|
71
75
|
* ci/01
|
72
76
|
* staging/01
|
73
77
|
* production/01
|
74
78
|
|
79
|
+
And the following stages in your capistrano file:
|
80
|
+
|
81
|
+
set :stages, [:ci, :staging, :production]
|
82
|
+
|
75
83
|
The deployments would look like this:
|
76
84
|
|
77
|
-
cap staging
|
78
|
-
cap production
|
85
|
+
cap staging release_tagger:set_branch # => sets branch to ci/01
|
86
|
+
cap production release_tagger:set_branch # => sets branch to staging/01
|
79
87
|
|
80
88
|
You can override with with the -Shead and -Stag options
|
81
89
|
|
82
|
-
cap staging
|
83
|
-
cap staging
|
90
|
+
cap staging release_tagger:set_branch -Shead=true # => sets branch to master
|
91
|
+
cap staging release_tagger:set_branch -Stag=staging/01 # => sets branch to staging/01
|
92
|
+
|
93
|
+
If you add `before "deploy:update_code", "release_tagger:set_branch"`, you can just deploy with:
|
94
|
+
|
95
|
+
cap staging deploy
|
96
|
+
|
97
|
+
and the branch will be set for you automatically.
|
98
|
+
|
99
|
+
### `release_tagger:create_tag`
|
100
|
+
|
101
|
+
This cap task creates a new tag, based on the latest tag from the previous environment.
|
102
|
+
|
103
|
+
If there is no tag from the previous stage, it creates a new tag from the latest commit in your _working directory_.
|
104
|
+
|
105
|
+
### `release_tagger:print_latest_tags`
|
106
|
+
|
107
|
+
This task reads the git version from the text file in shared:
|
108
|
+
|
109
|
+
cap staging release_tagger:read_tag_from_shared
|
110
|
+
|
111
|
+
### `release_tagger:print_latest_tags`
|
112
|
+
|
113
|
+
This task takes the latest tag from each environment and prints it to the screen. You can add it to your deploy.rb like so:
|
114
|
+
|
115
|
+
after "deploy", "release_tagger:print_latest_tags"
|
116
|
+
|
117
|
+
Or call it directly, like:
|
118
|
+
|
119
|
+
cap production release_tagger:print_latest_tags
|
120
|
+
|
121
|
+
This will produce output like:
|
122
|
+
|
123
|
+
** AUTO TAGGER: release tag history is:
|
124
|
+
** ci ci/20090331045345 8031807feb5f4f99dd83257cdc07081fa6080cba some commit message
|
125
|
+
** staging staging/20090331050908 8031807feb5f4f99dd83257cdc07081fa6080cba some commit message
|
126
|
+
** production production/20090331050917 8031807feb5f4f99dd83257cdc07081fa6080cba some commit message
|
127
|
+
|
128
|
+
## Acknowledgments
|
129
|
+
|
130
|
+
Special thanks to Brian Takita for the original recipes, and to Mike Dalessio for his git fu.
|
84
131
|
|
85
132
|
## Links
|
86
133
|
|
data/bin/autotag
CHANGED
@@ -5,16 +5,20 @@ def usage
|
|
5
5
|
puts
|
6
6
|
puts "USAGE: #{File.basename($0)} [-h] [<stage> <repository>]"
|
7
7
|
puts
|
8
|
-
puts '
|
9
|
-
puts '
|
10
|
-
puts '
|
8
|
+
puts ' where: -h displays this help message'
|
9
|
+
puts ' stage sets the tag prefix'
|
10
|
+
puts ' repository sets the repository to act on'
|
11
|
+
puts
|
12
|
+
puts ' example: autotag demo'
|
11
13
|
puts
|
12
14
|
exit 1
|
13
15
|
end
|
14
16
|
|
15
|
-
if ARGV[0] &&
|
17
|
+
if ARGV[0] && ["-h", "--help"].include?(ARGV[0])
|
16
18
|
usage
|
17
19
|
elsif ARGV[0]
|
18
20
|
AutoTagger.new(ARGV[0], ARGV[1]).create_tag
|
19
21
|
exit 1
|
22
|
+
else
|
23
|
+
usage
|
20
24
|
end
|