Skip to content

Commit

Permalink
auto-run cargo release when verison= line in Cargo.toml changes
Browse files Browse the repository at this point in the history
  • Loading branch information
duckinator committed Oct 16, 2024
1 parent 462b9ce commit 149c649
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
15 changes: 0 additions & 15 deletions .cirrus.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tests

on: push

jobs:
run-tests:
runs-on: "ubuntu-20.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
run: rustup update
- name: Run tests
run: cargo test

release-if-needed:
runs-on: "ubuntu-20.04"
needs: run-tests
# Only run if tests passed and the branch is main.
#if: ${{ github.ref == 'refs/heads/main' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check if version in Cargo.toml has changed
id: project
run: |
git diff-tree -r -G'^version ?= ?"*"' --exit-code HEAD Cargo.toml
VERSION_CHANGED=$?
echo "VERSION_CHANGED=${VERSION_CHANGED}" >> "$GITHUB_OUTPUT"
true # Always succeed.
- name: Install Rust
if: steps.project.VERSION_CHANGED == '1'
run: rustup update
- name: Install cargo-release
if: steps.project.VERSION_CHANGED == '1'
run: cargo install cargo-release
- name: Run cargo-release
if: steps.project.VERSION_CHANGED == '1'
run: cargo release
#run: cargo release --execute
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stayfocused"
version = "0.2.2"
version = "0.2.3"
description = "Software To Avoid [Y] Fixating On Completely Unproductive Shit Every Day"

repository = "https://github.com/duckinator/STAYFOCUSED"
Expand Down

0 comments on commit 149c649

Please sign in to comment.