Fix Demo link, add GH release from Make and more
This commit is contained in:
Manuele Sarfatti 2025-05-11 18:30:57 +02:00
parent 881d91b43b
commit 06d06f73f2
2 changed files with 13 additions and 5 deletions

View file

@ -4,6 +4,7 @@ OUT_DIR = dist
OUTPUT = $(OUT_DIR)/beddu.sh OUTPUT = $(OUT_DIR)/beddu.sh
SRC_DIR = src SRC_DIR = src
DEMO_DIR = demo DEMO_DIR = demo
README = README.md
YEAR = $(shell date +%Y) YEAR = $(shell date +%Y)
IP = $(shell curl -s ipinfo.io/ip) IP = $(shell curl -s ipinfo.io/ip)
@ -29,19 +30,26 @@ demo: build
_release: _release:
@if [ -z "$(filter-out $@,$(MAKECMDGOALS))" ]; then \ @if [ -z "$(filter-out $@,$(MAKECMDGOALS))" ]; then \
echo "Error: Please specify a version number (e.g. make release v0.0.5)"; \ echo "Error: Please specify a version number (e.g. make _release v0.0.5)"; \
exit 1; \ exit 1; \
fi fi
$(eval VERSION := $(filter-out $@,$(MAKECMDGOALS))) $(eval VERSION := $(filter-out $@,$(MAKECMDGOALS)))
@if [ "$$(git branch --show-current)" != "main" ]; then \
echo "Error: Releases can only be made from the main branch"; \
exit 1; \
fi
@if ! git diff-index --quiet HEAD --; then \ @if ! git diff-index --quiet HEAD --; then \
echo "Error: Git working directory is not clean. Please commit or stash your changes first."; \ echo "Error: Git working directory is not clean. Please commit or stash your changes first."; \
exit 1; \ exit 1; \
fi; \ fi; \
$(MAKE) build; \ $(MAKE) build; \
sed -i '' "s/# Version: .*/# Version: $(VERSION)/" $(OUTPUT); \ sed -i '' "s/# Version: .*/# Version: $(VERSION)/" $(OUTPUT); \
git add $(OUTPUT); \ sed -i '' "s/v[0-9]\+\.[0-9]\+\.[0-9]\+/$(VERSION)/" $(README); \
git add $(OUTPUT) $(README); \
git commit -m "Release $(VERSION)"; \ git commit -m "Release $(VERSION)"; \
git tag -a "$(VERSION)" -m "Release $(VERSION)" git tag -a "$(VERSION)" -m "Release $(VERSION)"; \
git push origin --tags; \
gh release create "$(VERSION)" --generate-notes --title "$(VERSION)" "$(OUTPUT)#beddu.sh"; \
@echo "\nRelease complete: \033[32m$(VERSION)\033[0m" @echo "\nRelease complete: \033[32m$(VERSION)\033[0m"
# Get the last version tag and increment the appropriate part # Get the last version tag and increment the appropriate part

View file

@ -26,10 +26,10 @@ And you will easily be able to build things like:
**Beddu** is meant to be sourced in your own script. **Beddu** is meant to be sourced in your own script.
1. Download `beddu.sh` to your project: 1. Download the latest release (currently: **v0.0.9**) of `beddu.sh` to your project:
```bash ```bash
$ curl -O https://raw.githubusercontent.com/mjsarfatti/beddu/main/beddu.sh $ curl -O https://raw.githubusercontent.com/mjsarfatti/beddu/refs/tags/v0.0.9/dist/beddu.sh
``` ```
2. Source the `beddu.sh` file in your script: 2. Source the `beddu.sh` file in your script: