mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-25 03:49:11 +00:00
ci: add build stamping
This commit is contained in:
parent
54a8739afd
commit
ff27f1080b
4 changed files with 20 additions and 15 deletions
11
.github/workflows/build.yml
vendored
11
.github/workflows/build.yml
vendored
|
@ -24,14 +24,19 @@ jobs:
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
"${GITHUB_WORKSPACE}/bin/bazel" test //src/...
|
"${GITHUB_WORKSPACE}/bin/bazel" test \
|
||||||
|
--stamp \
|
||||||
|
--workspace_status_command hack/workspace_status.sh \
|
||||||
|
//src/...
|
||||||
|
|
||||||
- name: Docker Login
|
- name: Docker Login
|
||||||
run: |
|
run: |
|
||||||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
echo ${{github.token}} | docker login -u ${{GITHUB_ACTOR}} --password-stdin
|
||||||
|
|
||||||
- name: Publish Artifacts
|
- name: Publish Artifacts
|
||||||
run: |
|
run: |
|
||||||
"${GITHUB_WORKSPACE}/bin/bazel" query //src/... |\
|
"${GITHUB_WORKSPACE}/bin/bazel" query //src/... |\
|
||||||
grep +publish |\
|
grep +publish |\
|
||||||
xargs -l1 "${GITHUB_WORKSPACE}/bin/bazel" run
|
xargs -l1 "${GITHUB_WORKSPACE}/bin/bazel" run \
|
||||||
|
--stamp \
|
||||||
|
--workspace_status_command hack/workspace_status.sh
|
||||||
|
|
4
hack/workspace_status.sh
Executable file
4
hack/workspace_status.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "STABLE_GIT_COMMIT $(git rev-parse --short HEAD)"
|
||||||
|
echo "STABLE_GIT_BRANCH $(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
echo "BUILD_DATE $(date -Iseconds)"
|
|
@ -5,6 +5,11 @@ go_library(
|
||||||
srcs = ["version.go"],
|
srcs = ["version.go"],
|
||||||
importpath = "github.com/roleypoly/roleypoly/src/common/version",
|
importpath = "github.com/roleypoly/roleypoly/src/common/version",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
|
x_defs = {
|
||||||
|
"GitCommit": "{STABLE_GIT_COMMIT}",
|
||||||
|
"GitBranch": "{STABLE_GIT_BRANCH}",
|
||||||
|
"BuildDate": "{BUILD_DATE}",
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
go_test(
|
go_test(
|
||||||
|
|
|
@ -36,16 +36,7 @@ container_push(
|
||||||
name = "+publish",
|
name = "+publish",
|
||||||
format = "Docker",
|
format = "Docker",
|
||||||
image = ":image",
|
image = ":image",
|
||||||
registry = "docker.io",
|
registry = "docker.pkg.github.com",
|
||||||
repository = "roleypoly/discord-bot",
|
repository = "roleypoly/roleypoly/discord-bot",
|
||||||
tag = "dev2",
|
tag = "{STABLE_GIT_BRANCH}",
|
||||||
)
|
|
||||||
|
|
||||||
container_push(
|
|
||||||
name = "+publish-2",
|
|
||||||
format = "Docker",
|
|
||||||
image = ":image",
|
|
||||||
registry = "docker.io",
|
|
||||||
repository = "roleypoly/discord-bot",
|
|
||||||
tag = "dev",
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue