@@ -132,17 +132,6 @@ function collect_versions()
132
132
return versions
133
133
end
134
134
135
- function withfile (f, file, contents)
136
- hasfile = isfile (file)
137
- original = hasfile ? read (file) : nothing
138
- write (file, contents)
139
- try
140
- f ()
141
- finally
142
- hasfile ? write (file, original) : rm (file)
143
- end
144
- end
145
-
146
135
# similar to Documenter.deploydocs
147
136
function commit ()
148
137
if get (ENV , " TRAVIS_PULL_REQUEST" , " true" ) != " false"
@@ -151,32 +140,33 @@ function commit()
151
140
end
152
141
@info " committing built PDF files."
153
142
154
- # initialize git
155
- run (` git config user.name "zeptodoctor"` )
156
- run (
` git config user.email "[email protected] "` )
157
- # committing all .pdf files
158
- run (` git add '*.pdf'` )
159
- run (` git commit --amend --date=now -m "PDF versions of Julia's manual."` )
160
-
161
- # setting up ssh key and force push
162
- keyfile = abspath (" .documenter" )
163
- try
164
- write (keyfile, String (base64decode (get (ENV , " DOCUMENTER_KEY_PDF" , " " ))))
143
+ mktemp () do keyfile, iokey; mktemp () do sshconfig, iossh
144
+ # Set up keyfile
145
+ write (iokey, base64decode (get (ENV , " DOCUMENTER_KEY_PDF" , " " )))
146
+ close (iokey)
165
147
chmod (keyfile, 0o600 )
166
- withfile (" $(homedir ()) /.ssh/config" ,
148
+ # Set up ssh config file
149
+ print (iossh,
167
150
"""
168
151
Host github.com
169
152
StrictHostKeyChecking no
170
153
HostName github.com
171
154
IdentityFile $keyfile
172
155
BatchMode yes
173
- """ ) do
174
- run (
` git remote set-url origin [email protected] :JuliaLang/docs.julialang.org.git` )
175
- run (` git push -f origin assets` )
176
- end
177
- finally
178
- rm (keyfile; force= true )
179
- end
156
+ """ )
157
+ close (iossh)
158
+ chmod (sshconfig, 0o600 )
159
+ # Configure git
160
+ run (` git config user.name "zeptodoctor"` )
161
+ run (
` git config user.email "[email protected] "` )
162
+ run (
` git remote set-url origin [email protected] :JuliaLang/docs.julialang.org.git` )
163
+ run (` git config core.sshCommand "ssh -F $(sshconfig) "` )
164
+ # Committing all .pdf files
165
+ run (` git add '*.pdf'` )
166
+ run (` git commit --amend --date=now -m "PDF versions of Julia's manual."` )
167
+ # Push
168
+ run (` git push -f origin assets` )
169
+ end end
180
170
end
181
171
182
172
function main ()
0 commit comments