mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39: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
|
||||
run: |
|
||||
"${GITHUB_WORKSPACE}/bin/bazel" test //src/...
|
||||
"${GITHUB_WORKSPACE}/bin/bazel" test \
|
||||
--stamp \
|
||||
--workspace_status_command hack/workspace_status.sh \
|
||||
//src/...
|
||||
|
||||
- name: Docker Login
|
||||
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
|
||||
run: |
|
||||
"${GITHUB_WORKSPACE}/bin/bazel" query //src/... |\
|
||||
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"],
|
||||
importpath = "github.com/roleypoly/roleypoly/src/common/version",
|
||||
visibility = ["//visibility:public"],
|
||||
x_defs = {
|
||||
"GitCommit": "{STABLE_GIT_COMMIT}",
|
||||
"GitBranch": "{STABLE_GIT_BRANCH}",
|
||||
"BuildDate": "{BUILD_DATE}",
|
||||
},
|
||||
)
|
||||
|
||||
go_test(
|
||||
|
|
|
@ -36,16 +36,7 @@ container_push(
|
|||
name = "+publish",
|
||||
format = "Docker",
|
||||
image = ":image",
|
||||
registry = "docker.io",
|
||||
repository = "roleypoly/discord-bot",
|
||||
tag = "dev2",
|
||||
)
|
||||
|
||||
container_push(
|
||||
name = "+publish-2",
|
||||
format = "Docker",
|
||||
image = ":image",
|
||||
registry = "docker.io",
|
||||
repository = "roleypoly/discord-bot",
|
||||
tag = "dev",
|
||||
registry = "docker.pkg.github.com",
|
||||
repository = "roleypoly/roleypoly/discord-bot",
|
||||
tag = "{STABLE_GIT_BRANCH}",
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue