You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +02:00 
			
		
		
		
	feat: allow to load config from stdin (#3175)
allows to load the config from stdin, so things like: ```sh cat .goreleaser.yml | sed 's/something/else/g' | goreleaser release -f - ``` will now work. closes #3125 Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							d79484ef1d
						
					
				
				
					commit
					4162772819
				
			| @@ -8,6 +8,10 @@ import ( | ||||
| ) | ||||
|  | ||||
| func loadConfig(path string) (config.Project, error) { | ||||
| 	if path == "-" { | ||||
| 		log.Info("loading config from stdin") | ||||
| 		return config.LoadReader(os.Stdin) | ||||
| 	} | ||||
| 	if path != "" { | ||||
| 		return config.Load(path) | ||||
| 	} | ||||
|   | ||||
| @@ -37,3 +37,12 @@ func TestConfigFileDoesntExist(t *testing.T) { | ||||
| 	require.NoError(t, err) | ||||
| 	require.Equal(t, config.Project{}, proj) | ||||
| } | ||||
|  | ||||
| func TestConfigFileFromStdin(t *testing.T) { | ||||
| 	folder := setup(t) | ||||
| 	err := os.Remove(filepath.Join(folder, "goreleaser.yml")) | ||||
| 	require.NoError(t, err) | ||||
| 	proj, err := loadConfig("-") | ||||
| 	require.NoError(t, err) | ||||
| 	require.Equal(t, config.Project{}, proj) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user