migrating to a release command.
This commit is contained in:
4
.github/workflows/go.yml
vendored
4
.github/workflows/go.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
# This workflow will build a golang project
|
# This workflow will release a golang project
|
||||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
|
||||||
|
|
||||||
name: Go
|
name: Go
|
||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
go-version: 1.19
|
go-version: 1.19
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build -v ./...
|
run: go release -v ./...
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test -v ./...
|
run: go test -v ./...
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ var (
|
|||||||
ParentGitCommit = "%s"
|
ParentGitCommit = "%s"
|
||||||
// BuildTime stores the time when the current binary was built.
|
// BuildTime stores the time when the current binary was built.
|
||||||
BuildTime = "%s"
|
BuildTime = "%s"
|
||||||
// SemVer lists the (latest) git tag on the build.
|
// SemVer lists the (latest) git tag on the release.
|
||||||
SemVer = "%s"
|
SemVer = "%s"
|
||||||
// PathBase is the path base returned from runtime caller.
|
// PathBase is the path base returned from runtime caller.
|
||||||
PathBase = "%s"
|
PathBase = "%s"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Package main is a tool for creating version information to be placed at the
|
// Package main is a tool for creating version information to be placed at the
|
||||||
// repository root of a project.
|
// repository root of a project.
|
||||||
//
|
//
|
||||||
// It provides basic build information, references the parent Git commit hash,
|
// It provides basic release information, references the parent Git commit hash,
|
||||||
// automatically increments the minor version, tags the commit with the version
|
// automatically increments the minor version, tags the commit with the version
|
||||||
// so that it is easy for importing projects to use a Semantic Versioning
|
// so that it is easy for importing projects to use a Semantic Versioning
|
||||||
// version code instead of depending on automatic generated codes from Go's
|
// version code instead of depending on automatic generated codes from Go's
|
||||||
@@ -194,7 +194,7 @@ var (
|
|||||||
ParentGitCommit = "%s"
|
ParentGitCommit = "%s"
|
||||||
// BuildTime stores the time when the current binary was built.
|
// BuildTime stores the time when the current binary was built.
|
||||||
BuildTime = "%s"
|
BuildTime = "%s"
|
||||||
// SemVer lists the (latest) git tag on the build.
|
// SemVer lists the (latest) git tag on the release.
|
||||||
SemVer = "%s"
|
SemVer = "%s"
|
||||||
// PathBase is the path base returned from runtime caller.
|
// PathBase is the path base returned from runtime caller.
|
||||||
PathBase = "%s"
|
PathBase = "%s"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ RUN addgroup ${GROUP} --gid ${GID} \
|
|||||||
"${USER}" \
|
"${USER}" \
|
||||||
&& mkdir -pv /var/indra/.indra && chown -R indra:indra /var/indra
|
&& mkdir -pv /var/indra/.indra && chown -R indra:indra /var/indra
|
||||||
|
|
||||||
# Source/Target build defaults
|
# Source/Target release defaults
|
||||||
ARG ARCH=amd64
|
ARG ARCH=amd64
|
||||||
ARG GOARCH=amd64
|
ARG GOARCH=amd64
|
||||||
|
|
||||||
@@ -31,8 +31,8 @@ RUN set -ex \
|
|||||||
# && if [ "${ARCH}" = "arm32v7" ]; then export GOARCH=arm; fi \
|
# && if [ "${ARCH}" = "arm32v7" ]; then export GOARCH=arm; fi \
|
||||||
# && if [ "${ARCH}" = "arm64v8" ]; then export GOARCH=arm64; fi \
|
# && if [ "${ARCH}" = "arm64v8" ]; then export GOARCH=arm64; fi \
|
||||||
&& go install -v ./cmd/indra/. \
|
&& go install -v ./cmd/indra/. \
|
||||||
&& mkdir -pv /build/bin \
|
&& mkdir -pv /release/bin \
|
||||||
&& CGO_ENABLED=0 go build --ldflags '-w -s' -o /build/bin/indra ./cmd/indra/.
|
&& CGO_ENABLED=0 go release --ldflags '-w -s' -o /release/bin/indra ./cmd/indra/.
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# Configure and Build the target container
|
# Configure and Build the target container
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ func (cli *Builder) Build() (err error) {
|
|||||||
buildOpts.Tags = append(buildOpts.Tags, buildRepositoryName + ":" + "stable")
|
buildOpts.Tags = append(buildOpts.Tags, buildRepositoryName + ":" + "stable")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a tar file for docker's build context. It will contain the root of the repository's path.
|
// Generate a tar file for docker's release context. It will contain the root of the repository's path.
|
||||||
// A tar file is passed in to the docker daemon.
|
// A tar file is passed in to the docker daemon.
|
||||||
|
|
||||||
var tar io.ReadCloser
|
var tar io.ReadCloser
|
||||||
@@ -68,9 +68,9 @@ func (cli *Builder) Build() (err error) {
|
|||||||
|
|
||||||
defer tar.Close()
|
defer tar.Close()
|
||||||
|
|
||||||
// Submit a build to docker; with the context tar, and default options defined above.
|
// Submit a release to docker; with the context tar, and default options defined above.
|
||||||
|
|
||||||
log.I.Ln("submitting build to docker...")
|
log.I.Ln("submitting release to docker...")
|
||||||
|
|
||||||
var response types.ImageBuildResponse
|
var response types.ImageBuildResponse
|
||||||
|
|
||||||
@@ -90,14 +90,14 @@ func (cli *Builder) Build() (err error) {
|
|||||||
|
|
||||||
// Prune the intermediate golang:x.xx builder container
|
// Prune the intermediate golang:x.xx builder container
|
||||||
|
|
||||||
log.I.Ln("pruning build container(s)...")
|
log.I.Ln("pruning release container(s)...")
|
||||||
|
|
||||||
if _, err = cli.ImagesPrune(cli.ctx, filters.NewArgs()); check(err) {
|
if _, err = cli.ImagesPrune(cli.ctx, filters.NewArgs()); check(err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.I.Ln("pruning successful.")
|
log.I.Ln("pruning successful.")
|
||||||
log.I.Ln("build successful!")
|
log.I.Ln("release successful!")
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ var (
|
|||||||
ParentGitCommit = "2dc3027cf28b04b52b8bca3839a96267122f8b92"
|
ParentGitCommit = "2dc3027cf28b04b52b8bca3839a96267122f8b92"
|
||||||
// BuildTime stores the time when the current binary was built.
|
// BuildTime stores the time when the current binary was built.
|
||||||
BuildTime = "2022-12-29T02:49:15Z"
|
BuildTime = "2022-12-29T02:49:15Z"
|
||||||
// SemVer lists the (latest) git tag on the build.
|
// SemVer lists the (latest) git tag on the release.
|
||||||
SemVer = "v0.0.255"
|
SemVer = "v0.0.255"
|
||||||
// PathBase is the path base returned from runtime caller.
|
// PathBase is the path base returned from runtime caller.
|
||||||
PathBase = "/home/lyo/Seafile/Git/indra-labs/indra/"
|
PathBase = "/home/lyo/Seafile/Git/indra-labs/indra/"
|
||||||
|
|||||||
Reference in New Issue
Block a user