Skip to content

Bump crate version to 0.20.0 #25

Bump crate version to 0.20.0

Bump crate version to 0.20.0 #25

Workflow file for this run

name: Create GitHub release and publish crate to crates.io
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Assert tag version matches crate version
id: release_version
run: |
set -euo pipefail
# Get release version from Git tag
tag_version=${GITHUB_REF#refs/tags/v}
# Get crate version from Cargo.toml
crate_version=$(cargo read-manifest | jq -r .version)
if [ "$tag_version" != "$crate_version" ]; then
echo "Error: Release version in Git tag (${tag_version}) does not match crate version in Cargo.toml (${crate_version})."
exit 1
fi
echo "version=$crate_version" > "$GITHUB_OUTPUT"
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: hcloud-rust v${{ steps.release_version.outputs.version }}
draft: true
- name: Publish crate to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish