Update README.md and create release #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update README.md and create release | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- README.md | |
- docs/** | |
- .buildkite/** | |
- .github/** | |
- docker-compose.yml | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: login to ghcr.io | |
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Calculate new version with autotag | |
run: | | |
curl -sL https://git.io/autotag-install | sh -s -- -b "${RUNNER_TEMP}/bin" | |
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@c7915d6c18d5ce4eb42b0eff3f10a29fe0766e4c # v0.1.44 | |
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@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- 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}} |