Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate tag pushes #597

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
41 changes: 41 additions & 0 deletions .github/workflows/create-version-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on:
push:
branches:
# - main

name: Create version tag

jobs:
tag_main_commit:
name: Check for tag-triggering commit to `main`
runs-on: ubuntu-latest
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"

steps:
- name: Install Ripgrep
run: sudo apt-get install ripgrep

- name: Is this a commit we need to tag?
id: tag_check
run: |
is_tagged_commit=$( \
echo "${{ github.event.head_commit.message }}" \
| rg "^🚀 Bump version to \d+\.\d+\.\d+" | wc -l \
)
echo "is_tagged_commit=$(($is_tagged_commit))" >> $GITHUB_OUTPUT

- name: Create the tag
if: steps.tag_check.outputs.is_tagged_commit == 1
id: get-version
run: |
new_version=$( \
echo "${{ github.event.head_commit.message }}" \
| cut -d " " -f 5 \
)
echo "tag_version=v$new_version" >> $GITHUB_OUTPUT
echo $new_version
echo $GITHUB_OUTPUT

- run: echo "${{ steps.get-version.tag_version }}"
if: steps.tag_check.outputs.is_tagged_commit == 1