Skip to content

Commit 700ff2b

Browse files
authored
Merge pull request #2 from planetscale/joem/gha-release-2
ci(gha): get docker builds working
2 parents eaae9a0 + 9e41bee commit 700ff2b

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

.github/workflows/release.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ on:
33
push:
44
branches:
55
- main
6+
- gha-release-2
67
paths-ignore:
78
- README.md
89
- .buildkite/**
910
- .github/**
1011
- docker-compose.yml
12+
workflow_dispatch:
1113

1214
jobs:
1315
build:
1416
runs-on: ubuntu-latest
1517

1618
permissions:
1719
contents: write
20+
packages: write
1821

1922
steps:
2023
- name: login to ghcr.io
@@ -28,20 +31,24 @@ jobs:
2831
with:
2932
fetch-depth: 0
3033

31-
- name: Update README.md
34+
- name: Calculate new version with autotag
3235
run: |
3336
curl -sL https://git.io/autotag-install | sh -s -- -b "${RUNNER_TEMP}/bin"
3437
set -x
3538
version=$(${RUNNER_TEMP}/bin/autotag -n)
39+
echo "version=$version" >> $GITHUB_ENV
40+
41+
- name: Update version in README.md and hooks/pre-command
42+
run: |
3643
sed -i'' -Ee "s/telemetry#v(.*):/telemetry#v${version}:/" README.md
44+
sed -i'' -Ee "s/TAG=\"v(.*)\"/TAG=\"v${version}\"/" hooks/pre-command
3745
38-
- name: Commit README.md
46+
- name: Commit changes
3947
uses: planetscale/ghcommit-action@c7915d6c18d5ce4eb42b0eff3f10a29fe0766e4c # v0.1.44
4048
with:
41-
commit_message: "🤖 Update README.md"
49+
commit_message: "🤖 Update version tag"
4250
repo: ${{ github.repository }}
4351
branch: ${{ github.head_ref || github.ref_name }}
44-
file_pattern: README.md
4552
env:
4653
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
4754

hooks/environment

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
BUILDKITE_TELEMETRY_PLUGIN_TMPDIR=$(mktemp -d)
3+
BUILDKITE_TELEMETRY_PLUGIN_OUTFILE="${BUILDKITE_TELEMETRY_PLUGIN_TMPDIR}/out.txt"
4+
5+
export BUILDKITE_TELEMETRY_PLUGIN_TMPDIR
6+
export BUILDKITE_TELEMETRY_PLUGIN_OUTFILE

hooks/post-command

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
set -eou pipefail
44
#set -x
55

6-
# TODO: proper tempdir scoped to this invocation
6+
docker stop -t1 telemetry-plugin
77

8-
docker stop -t1 dstat
98
echo "+++ :bar_chart: Telemetry:"
109
cat "$BUILDKITE_TELEMETRY_PLUGIN_OUTFILE"
1110

hooks/pre-command

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/usr/bin/env bash
22

33
set -eou pipefail
4-
set -x
4+
#set -x
55

6-
# TODO: proper tempdir scoped to this invocation
6+
TAG="v0.0.0"
77

88
docker run \
99
--rm \
1010
--init \
1111
--detach \
12-
--name dstat \
12+
--name telemetry-plugin \
1313
--pid host \
1414
--net host \
1515
--userns host \
1616
-v "$BUILDKITE_TELEMETRY_PLUGIN_TMPDIR:$BUILDKITE_TELEMETRY_PLUGIN_TMPDIR" \
17-
ghcr.io/planetscale/telemetry-buildkite-plugin:latest \
17+
ghcr.io/planetscale/telemetry-buildkite-plugin:"$TAG" \
1818
"dstat -t -c -m -n --disk-tps --disk --color --noupdate 10 > $BUILDKITE_TELEMETRY_PLUGIN_OUTFILE"
1919

2020
docker ps -a

0 commit comments

Comments
 (0)