-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the same version of sdk as variant for
variant export
(#41)
This changes the build and release scripts to embed the version number of variant deduced from GITHUB_REF in GitHub Actions, and enhances `variant export` to embed that version in generated go.mod files. Fixes #36
- Loading branch information
Showing
10 changed files
with
172 additions
and
32 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
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
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
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,38 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"os" | ||
"strings" | ||
) | ||
|
||
func main() { | ||
content, err := ioutil.ReadFile("go.mod") | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Error: %v\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
var replaces []string | ||
|
||
for _, l := range strings.Split(string(content), "\n") { | ||
if !strings.HasPrefix(l, "replace ") { | ||
continue | ||
} | ||
|
||
if !strings.Contains(l, " => ") { | ||
fmt.Fprintf(os.Stderr, "Unexpected line: ` => ` expected: %s\n", l) | ||
os.Exit(1) | ||
} | ||
|
||
l = strings.ReplaceAll(l, "replace ", "") | ||
l = strings.ReplaceAll(l, " => ", "=") | ||
l = strings.ReplaceAll(l, " ", "@") | ||
l = strings.TrimRight(l, "\n") | ||
|
||
replaces = append(replaces, l) | ||
} | ||
|
||
fmt.Print(strings.Join(replaces, ",")) | ||
} |
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,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
tag=${GITHUB_REF##*/} | ||
|
||
if [ -z "${tag}" ]; then | ||
echo GITHUB_REF must be set 1>&2 | ||
exit 1 | ||
fi | ||
|
||
export VERSION=${tag} | ||
export MOD_REPLACES=$(go run hack/print-replaces.go) | ||
|
||
if [ ! -z "${GITHUB_ENV}" ]; then | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
echo "MOD_REPLACES=${MOD_REPLACES}" >> $GITHUB_ENV | ||
fi |
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,5 @@ | ||
package sdk | ||
|
||
var Version string | ||
|
||
var ModReplaces string |