-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright Josh Komoroske. All rights reserved. | ||
// Use of this source code is governed by the MIT license, | ||
// a copy of which can be found in the LICENSE.txt file. | ||
// SPDX-License-Identifier: MIT | ||
|
||
// Package docker exposes functions for executing specific docker commands. | ||
package docker | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"strings" | ||
) | ||
|
||
// Login executes a docker login to ghcr.io with the given username and | ||
// password. | ||
func Login(username, password string) error { | ||
cmd := exec.Command("/usr/bin/docker", "login", "ghcr.io", "-u", username, "--password-stdin") | ||
cmd.Stdin = strings.NewReader(password + "\n") | ||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
|
||
return cmd.Run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters