-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (78 loc) · 2.97 KB
/
Copy pathrelease.yaml
File metadata and controls
92 lines (78 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Update README.md and create release
on:
push:
branches:
- main
paths-ignore:
- README.md
- docs/**
- .buildkite/**
- .github/**
- docker-compose.yml
- renovate.json5
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: login to ghcr.io
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: install autotag
# To bump: update AUTOTAG_VERSION and fetch the new SHA from the release's
# checksums.txt (autotag_<version>_checksums.txt, line matching 'autotag_linux_amd64$').
env:
AUTOTAG_VERSION: 1.4.3
AUTOTAG_SHA256: 85e7ec97d732800bb838085fd3f2e19b2aa2ee3a8da0db7fd0aaf4113a279f3a
run: |
set -euo pipefail
mkdir -p "${RUNNER_TEMP}/bin"
curl -fsSLo "${RUNNER_TEMP}/bin/autotag" \
"https://github.com/autotag-dev/autotag/releases/download/v${AUTOTAG_VERSION}/autotag_linux_amd64"
echo "${AUTOTAG_SHA256} ${RUNNER_TEMP}/bin/autotag" | sha256sum -c -
chmod +x "${RUNNER_TEMP}/bin/autotag"
- name: Calculate new version with autotag
run: |
set -x
version=$(${RUNNER_TEMP}/bin/autotag -n)
echo "version=$version" >> $GITHUB_ENV
- name: Update version in README.md and hooks/pre-command
run: |
sed -i'' -Ee "s/telemetry#v(.*):/telemetry#v${version}:/" README.md
sed -i'' -Ee "s/TAG=\"v(.*)\"/TAG=\"v${version}\"/" hooks/pre-command
- name: Commit changes
uses: planetscale/ghcommit-action@a6b150b81dca5dd027baa898604418eec9e11465 # v0.2.22
with:
commit_message: "🤖 Bump version"
repo: ${{ github.repository }}
branch: ${{ github.head_ref || github.ref_name }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# setup qemu and buildx for cross-builds (arm64)
- name: Set up QEMU (for arm64 builds)
uses: docker/setup-qemu-action@1f40c72289eff860ee54a304f1438e3cff362e0a # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
- name: Release
run: |
set -eou pipefail
set -x
image="ghcr.io/planetscale/telemetry-buildkite-plugin:v${version}"
git reset --hard && git clean -ffdx && git pull
docker buildx build \
-t "$image" \
--platform linux/amd64,linux/arm64 \
--push \
.
gh release create "v${version}" --target main --title "v${version}" --generate-notes
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}