You've already forked git-docker
							
							embed files [CI SKIP]
This commit is contained in:
		| @@ -72,6 +72,7 @@ tag) | |||||||
| 	;; | 	;; | ||||||
| esac | esac | ||||||
| ` | ` | ||||||
|  |  | ||||||
| // Contents of clone-commit | // Contents of clone-commit | ||||||
| const CloneCommit = `#!/bin/sh | const CloneCommit = `#!/bin/sh | ||||||
|  |  | ||||||
| @@ -91,6 +92,7 @@ set -x | |||||||
| git fetch ${FLAGS} origin +refs/heads/${DRONE_COMMIT_BRANCH}: | git fetch ${FLAGS} origin +refs/heads/${DRONE_COMMIT_BRANCH}: | ||||||
| git checkout ${DRONE_COMMIT_SHA} -b ${DRONE_COMMIT_BRANCH} | git checkout ${DRONE_COMMIT_SHA} -b ${DRONE_COMMIT_BRANCH} | ||||||
| ` | ` | ||||||
|  |  | ||||||
| // Contents of clone-pull-request | // Contents of clone-pull-request | ||||||
| const ClonePullRequest = `#!/bin/sh | const ClonePullRequest = `#!/bin/sh | ||||||
|  |  | ||||||
| @@ -113,6 +115,7 @@ git checkout ${DRONE_COMMIT_BRANCH} | |||||||
| git fetch origin ${DRONE_COMMIT_REF}: | git fetch origin ${DRONE_COMMIT_REF}: | ||||||
| git merge ${DRONE_COMMIT_SHA} | git merge ${DRONE_COMMIT_SHA} | ||||||
| ` | ` | ||||||
|  |  | ||||||
| // Contents of clone-tag | // Contents of clone-tag | ||||||
| const CloneTag = `#!/bin/sh | const CloneTag = `#!/bin/sh | ||||||
|  |  | ||||||
| @@ -132,4 +135,3 @@ set -x | |||||||
| git fetch ${FLAGS} origin +refs/tags/${DRONE_TAG}: | git fetch ${FLAGS} origin +refs/tags/${DRONE_TAG}: | ||||||
| git checkout -qf FETCH_HEAD | git checkout -qf FETCH_HEAD | ||||||
| ` | ` | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ import ( | |||||||
| 	"flag" | 	"flag" | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| 	"log" | 	"log" | ||||||
|  | 	"path/filepath" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"text/template" | 	"text/template" | ||||||
| ) | ) | ||||||
| @@ -31,7 +32,7 @@ func main() { | |||||||
| 		} | 		} | ||||||
| 		files = append(files, File{ | 		files = append(files, File{ | ||||||
| 			Name: file, | 			Name: file, | ||||||
| 			Slug: strings.ReplaceAll(strings.Title(file), "-", ""), | 			Slug: slugify(file), | ||||||
| 			Data: string(out), | 			Data: string(out), | ||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
| @@ -49,6 +50,15 @@ func main() { | |||||||
| 	ioutil.WriteFile(output, buf.Bytes(), 0644) | 	ioutil.WriteFile(output, buf.Bytes(), 0644) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func slugify(s string) string { | ||||||
|  | 	ext := filepath.Ext(s) | ||||||
|  | 	s = strings.TrimSuffix(s, ext) | ||||||
|  | 	s = strings.Title(s) | ||||||
|  | 	s = strings.ReplaceAll(s, "-", "") | ||||||
|  | 	s = strings.ReplaceAll(s, "_", "") | ||||||
|  | 	return s | ||||||
|  | } | ||||||
|  |  | ||||||
| type stringSlice []string | type stringSlice []string | ||||||
|  |  | ||||||
| func (s *stringSlice) String() string { | func (s *stringSlice) String() string { | ||||||
| @@ -73,5 +83,5 @@ var tmpl = template.Must(template.New("_").Parse(`package {{ .Package }} | |||||||
| {{ range .Files -}} | {{ range .Files -}} | ||||||
| // Contents of {{ .Name }} | // Contents of {{ .Name }} | ||||||
| const {{ .Slug }} = ` + "`{{ .Data }}`" + ` | const {{ .Slug }} = ` + "`{{ .Data }}`" + ` | ||||||
| {{ end }} |  | ||||||
| `)) | {{ end -}}`)) | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								windows/windows.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								windows/windows.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | package windows | ||||||
|  |  | ||||||
|  | //go:generate go run ../scripts/includetext.go --input=clone.ps1 --input=clone-commit.ps1 --input=clone-pull-request.ps1 --input=clone-tag.ps1 --package=windows --output=windows_gen.go | ||||||
							
								
								
									
										125
									
								
								windows/windows_gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								windows/windows_gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,125 @@ | |||||||
|  | package windows | ||||||
|  |  | ||||||
|  | // DO NOT EDIT. This file is automatically generated. | ||||||
|  |  | ||||||
|  | // Contents of clone.ps1 | ||||||
|  | const Clone = `$ErrorActionPreference = 'Stop'; | ||||||
|  |  | ||||||
|  | # HACK: no clue how to set the PATH inside the Dockerfile, | ||||||
|  | # so am setting it here instead. This is not idea. | ||||||
|  | $Env:PATH += ';C:\git\cmd;C:\git\mingw64\bin;C:\git\usr\bin' | ||||||
|  |  | ||||||
|  | # if the workspace is set we should make sure | ||||||
|  | # it is the current working directory. | ||||||
|  |  | ||||||
|  | if ($Env:DRONE_WORKSPACE) { | ||||||
|  |     cd $Env:DRONE_WORKSPACE | ||||||
|  | } | ||||||
|  |  | ||||||
|  | # if the netrc enviornment variables exist, write | ||||||
|  | # the netrc file. | ||||||
|  |  | ||||||
|  | if ($Env:DRONE_NETRC_MACHINE) { | ||||||
|  | @" | ||||||
|  | machine $Env:DRONE_NETRC_MACHINE | ||||||
|  | login $Env:DRONE_NETRC_USERNAME | ||||||
|  | password $Env:DRONE_NETRC_PASSWORD | ||||||
|  | "@ > (Join-Path $Env:USERPROFILE '_netrc'); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | # configure git global behavior and parameters via the | ||||||
|  | # following environment variables: | ||||||
|  |  | ||||||
|  | if ($Env:PLUGIN_SKIP_VERIFY) { | ||||||
|  |     $Env:GIT_SSL_NO_VERIFY = "true" | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($Env:DRONE_COMMIT_AUTHOR_NAME) { | ||||||
|  |     $Env:GIT_AUTHOR_NAME = $Env:DRONE_COMMIT_AUTHOR_NAME | ||||||
|  | } else { | ||||||
|  |     $Env:GIT_AUTHOR_NAME = "drone" | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($Env:DRONE_COMMIT_AUTHOR_NAME) { | ||||||
|  |     $Env:GIT_AUTHOR_NAME = $Env:DRONE_COMMIT_AUTHOR_NAME | ||||||
|  | } else { | ||||||
|  |     $Env:GIT_AUTHOR_NAME = 'drone@localhost' | ||||||
|  | } | ||||||
|  |  | ||||||
|  | $Env:GIT_COMMITTER_NAME  = $Env:GIT_AUTHOR_NAME | ||||||
|  | $Env:GIT_COMMITTER_EMAIL = $Env:GIT_AUTHOR_EMAIL | ||||||
|  |  | ||||||
|  | # invoke the sub-script based on the drone event type. | ||||||
|  | # TODO we should ultimately look at the ref, since | ||||||
|  | # we need something compatible with deployment events. | ||||||
|  |  | ||||||
|  | switch ($Env:DRONE_BUILD_EVENT) { | ||||||
|  |     "pull_request" { | ||||||
|  |         Invoke-Expression "${PSScriptRoot}\clone-pull-request.ps1" | ||||||
|  |         break | ||||||
|  |     } | ||||||
|  |     "tag" { | ||||||
|  |         Invoke-Expression "${PSScriptRoot}\clone-tag.ps1" | ||||||
|  |         break | ||||||
|  |     } | ||||||
|  |     default { | ||||||
|  |         Invoke-Expression "${PSScriptRoot}\clone-commit.ps1" | ||||||
|  |         break | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | ` | ||||||
|  |  | ||||||
|  | // Contents of clone-commit.ps1 | ||||||
|  | const CloneCommit = ` | ||||||
|  | Set-Variable -Name "FLAGS" -Value "" | ||||||
|  | if ($Env:PLUGIN_DEPTH) { | ||||||
|  |     Set-Variable -Name "FLAGS" -Value "--depth=$Env:PLUGIN_DEPTH"  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if (!(Test-Path .git)) { | ||||||
|  | 	Write-Host 'git init'; | ||||||
|  | 	git init | ||||||
|  | 	Write-Host "git remote add origin $Env:DRONE_REMOTE_URL" | ||||||
|  | 	git remote add origin $Env:DRONE_REMOTE_URL | ||||||
|  | } | ||||||
|  |  | ||||||
|  | Write-Host "git fetch $FLAGS origin +refs/heads/${Env:DRONE_COMMIT_BRANCH}:"; | ||||||
|  | git fetch $FLAGS origin "+refs/heads/${Env:DRONE_COMMIT_BRANCH}:"; | ||||||
|  | Write-Host "git checkout $Env:DRONE_COMMIT_SHA -f $Env:DRONE_COMMIT_BRANCH"; | ||||||
|  | git checkout $Env:DRONE_COMMIT_SHA -b $Env:DRONE_COMMIT_BRANCH; | ||||||
|  | ` | ||||||
|  |  | ||||||
|  | // Contents of clone-pull-request.ps1 | ||||||
|  | const ClonePullRequest = ` | ||||||
|  | Set-Variable -Name "FLAGS" -Value "" | ||||||
|  | if ($Env:PLUGIN_DEPTH) { | ||||||
|  |     Set-Variable -Name "FLAGS" -Value "--depth=$Env:PLUGIN_DEPTH"  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if (!(Test-Path .git)) { | ||||||
|  | 	git init | ||||||
|  | 	git remote add origin $Env:DRONE_REMOTE_URL | ||||||
|  | } | ||||||
|  |  | ||||||
|  | git fetch $FLAGS origin "+refs/heads/${Env:DRONE_COMMIT_BRANCH}:" | ||||||
|  | git checkout $Env:DRONE_COMMIT_BRANCH | ||||||
|  |  | ||||||
|  | git fetch origin $Env:DRONE_COMMIT_REF: | ||||||
|  | git rebase $Env:DRONE_COMMIT_SHA | ||||||
|  | ` | ||||||
|  |  | ||||||
|  | // Contents of clone-tag.ps1 | ||||||
|  | const CloneTag = ` | ||||||
|  | Set-Variable -Name "FLAGS" -Value "" | ||||||
|  | if ($Env:PLUGIN_DEPTH) { | ||||||
|  |     Set-Variable -Name "FLAGS" -Value "--depth=$Env:PLUGIN_DEPTH"  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if (!(Test-Path .git)) { | ||||||
|  | 	git init | ||||||
|  | 	git remote add origin $Env:DRONE_REMOTE_URL | ||||||
|  | } | ||||||
|  |  | ||||||
|  | git fetch $FLAGS origin "+refs/tags/${Env:DRONE_TAG}:" | ||||||
|  | git checkout -qf FETCH_HEAD | ||||||
|  | ` | ||||||
		Reference in New Issue
	
	Block a user
	 Brad Rydzewski
					Brad Rydzewski