name: Setup Environment
on:
workflow_call:
outputs:
cargo_cache_key:
description: "Cargo cache key for the build"
value: ${{ jobs.setup-environment.outputs.cargo_cache_key }}
jobs:
setup-environment:
runs-on: ubuntu-latest
outputs:
cargo_cache_key: ${{ steps.cargo_cache_key.outputs.value }}
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Set cargo cache key
id: cargo_cache_key
run: |
CARGO_CACHE_KEY="${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}"
echo "value=$CARGO_CACHE_KEY" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
~/.cargo/bin
key: ${{ steps.cargo_cache_key.outputs.value }}
id: cache-cargo-release
- name: Ensure changelog entry for version exists
run: |
version=$(cargo read-manifest | jq -r ".version")
if ! grep -q "\[$version\]" ./CHANGELOG.md; then
echo "Changelog doesn't contain an entry for this version: $version"
exit 1
fi