1
0
mirror of https://github.com/containers/netavark.git synced 2026-02-05 15:45:47 +01:00

release,make: add rule crate-publish for publishing crates.io

* Add new rule `make crate-publish` to automate publish at https://crates.io/crates/netavark
* Document steps for publishing to `crates.io`

Signed-off-by: Aditya R <arajan@redhat.com>
This commit is contained in:
Aditya R
2022-12-06 12:05:06 +05:30
parent 5f36309a1e
commit 011f899919
2 changed files with 20 additions and 0 deletions

View File

@@ -10,6 +10,9 @@ LIBEXECDIR ?= ${PREFIX}/libexec
LIBEXECPODMAN ?= ${LIBEXECDIR}/podman
SELINUXOPT ?= $(shell test -x /usr/sbin/selinuxenabled && selinuxenabled && echo -Z)
# Get crate version by parsing the line that starts with version.
CRATE_VERSION ?= $(shell grep ^version Cargo.toml | awk '{print $$3}')
GIT_TAG ?= $(shell git describe --tags)
# Set this to any non-empty string to enable unoptimized
# build w/ debugging features.
@@ -47,6 +50,16 @@ build: bin $(CARGO_TARGET_DIR)
cargo build $(release)
cp $(CARGO_TARGET_DIR)/$(profile)/netavark bin/netavark$(if $(debug),.debug,)
.PHONY: crate-publish
crate-publish:
@if [ "$(CRATE_VERSION)" != "$(GIT_TAG)" ]; then\
echo "Git tag is not equivalent to the version set in Cargo.toml. Please checkout the correct tag";\
exit 1;\
fi
@echo "It is expected that you have already done 'cargo login' before running this command. If not command may fail later"
cargo publish --dry-run
cargo publish
.PHONY: clean
clean:
rm -rf bin

7
docs/publish-crate.md Normal file
View File

@@ -0,0 +1,7 @@
# Publishing netavark crate to crates.io
### Steps
* Make sure you have already done `cargo login` on your current session with a valid token.
* `cd netavark`
* Git checkout the version which you want to publish.
* `make crate-publish`
* New version should be reflected here: https://crates.io/crates/netavark/versions