Skip to content

Updated the build CI to create a tag when the version is incremented #11

Updated the build CI to create a tag when the version is incremented

Updated the build CI to create a tag when the version is incremented #11

Workflow file for this run

name: Rust CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Clippy
run: cargo clippy --verbose -- -D warnings
- name: Determine version change
id: version_change
run: |
previous_version=$(git describe --abbrev=0 --tags || echo "")
current_version=$(awk -F\" '/version/ {print $2}' Cargo.toml")
echo "::set-output name=version_changed::$(test -z "$previous_version" || test "$previous_version" != "$current_version"; echo $?)"
- name: Create release
id: create_release
if: ${{ needs.version_change.outputs.version_changed == '0' }}
run: |
git tag $current_version
git push --tags