yavsc/Makefile

124 lines
4 KiB
Makefile
Raw Normal View History

2021-04-05 02:11:19 +01:00
2019-12-11 16:42:07 +00:00
CONFIG=Debug
2026-02-07 23:44:51 +00:00
FRAMEWORK=net9.0
DESTDIR=/tmp/yavsc
2026-02-14 16:54:27 +00:00
APP_PATH=srv/www/yavsc
APP_FULL_PATH=$(DESTDIR)/$(APP_PATH)
2020-10-18 23:00:17 +01:00
2026-06-15 00:33:38 +01:00
include .env
2025-08-19 21:31:49 +01:00
all:
2025-11-16 15:53:13 +00:00
dotnet build --nologo
2025-08-19 21:31:49 +01:00
2026-07-05 23:56:10 +01:00
clean:
dotnet clean -c $(CONFIG)
2019-01-30 17:52:19 +00:00
2021-04-05 01:13:24 +01:00
src/Yavsc/bin/output/wwwroot:
2026-05-24 00:59:38 +01:00
dotnet --project src/Yavsc.Org/Yavsc.Org.csproj publish
2020-11-01 20:28:00 +00:00
2019-01-30 17:52:19 +00:00
test:
2026-06-19 01:36:08 +01:00
ASPNETCORE_ENVIRONMENT=Development dotnet test
2019-01-30 17:52:19 +00:00
2025-09-14 02:42:08 +01:00
watch:
2025-02-24 21:13:25 +00:00
dotnet watch -p:Configuration=$(CONFIG) --project src/Yavsc/Yavsc.csproj
2021-06-28 22:34:18 +01:00
2025-02-24 21:13:25 +00:00
src/Yavsc.Abstract/bin/$(CONFIG)/$(FRAMEWORK)/Yavsc.Abstract.dll:
dotnet build -p:Configuration=$(CONFIG) --project src/Yavsc.Abstract/Yavsc.Abstract.csproj
2021-03-16 00:59:24 +00:00
2025-02-24 21:13:25 +00:00
src/Yavsc.Server/bin/$(CONFIG)/$(FRAMEWORK)/Yavsc.Server.dll:
dotnet build -p:Configuration=$(CONFIG) --project src/Yavsc.Server/Yavsc.Server.csproj
2021-03-10 01:41:31 +00:00
2025-02-24 21:13:25 +00:00
src/Yavsc/bin/$(CONFIG)/$(FRAMEWORK)/Yavsc.dll:
2026-05-24 00:59:38 +01:00
dotnet build -p:Configuration=$(CONFIG) --project src/Yavsc.Org/Yavsc.Org.csproj
2020-10-10 18:29:06 +01:00
2026-07-05 23:56:10 +01:00
$(DESTDIR):
2026-02-14 16:54:27 +00:00
mkdir $(DESTDIR)
2026-02-14 16:54:27 +00:00
install: $(DESTDIR)
2026-05-24 00:59:38 +01:00
dotnet publish src/Yavsc.Org/Yavsc.Org.csproj -c Release -o $(APP_FULL_PATH)
2026-02-14 16:54:27 +00:00
dotnet publish src/Api/Api.csproj -c Release -o $(APP_FULL_PATH)
sudo chown -R www-data:www-data $(APP_FULL_PATH)
2026-02-07 23:44:51 +00:00
docker-image:
docker build .
2026-05-30 15:41:59 +01:00
docker-build:
docker compose up --build
docker-run:
docker run -d -p 5000:5000 --name yavsc yavsc
# Crée une branche release/<V> depuis main, met à jour les
# `<Version>` des .csproj via dotnet-gitversion, et la
# pousse sur origin.
#
# Usage : make release V=1.0.7-rc1
#
# Pré-requis : être sur main, working tree clean. La cible
# vérifie les deux et refuse sinon — elle ne fait JAMAIS
# de checkout automatique, c'est à l'opérateur de s'être
# positionné sur la bonne branche au préalable (sinon le
# bump pourrait partir sur une branche tierce par accident).
#
# Notes :
# - Le nom de branche vient de l'argument V (ex: 1.0.7-rc1
# donne release/1.0.7-rc1). C'est une étiquette d'intention,
# pas la version assembly.
# - La version dans les .csproj vient de GitVersion qui la
# calcule depuis l'historique git (tag le plus proche +
# nombre de commits). C'est la version assembly réelle.
# - L'ordre (fetch → branche → bump → push) garantit qu'on
# part d'un main synchro et qu'on ne pollue pas main avec
# le bump (qui vit sur la branche release).
# - Fail-fast si la branche existe déjà en local ou sur origin.
release:
@if [ -z "$(V)" ]; then \
echo "Usage: make release V=<version>"; \
echo " V : version semver (ex. 1.0.7-rc1) — sert à nommer la branche."; \
exit 1; \
fi
@CURRENT=$$(git branch --show-current); \
if [ "$$CURRENT" != "main" ]; then \
echo "Refus : la cible doit être lancée depuis main."; \
echo " Branche courante : $$CURRENT"; \
echo " Fais : git checkout main && git pull --ff-only origin main"; \
exit 1; \
fi
@if [ -n "$$(git status --porcelain)" ]; then \
echo "Working tree sale, refus de créer une branche release."; \
git status --short; \
exit 1; \
fi
@BRANCH="release/$(V)"; \
if git show-ref --verify --quiet "refs/heads/$$BRANCH"; then \
echo "La branche $$BRANCH existe déjà en local."; \
echo " Pour la supprimer : git branch -D $$BRANCH"; \
exit 1; \
fi; \
if git ls-remote --exit-code --heads origin "$$BRANCH" >/dev/null 2>&1; then \
echo "La branche $$BRANCH existe déjà sur origin."; \
exit 1; \
fi; \
echo "==> Fetch + vérification synchro main"; \
git fetch origin main; \
if ! git merge-base --is-ancestor origin/main HEAD; then \
echo "main a avancé plus loin que HEAD. Fais :"; \
echo " git pull --ff-only origin main"; \
exit 1; \
fi; \
echo "==> Création de $$BRANCH depuis main"; \
git checkout -b "$$BRANCH"; \
echo "==> dotnet-gitversion /updateprojectfiles"; \
dotnet-gitversion /updateprojectfiles; \
echo "==> Commit du bump"; \
git add .; \
if git diff --cached --quiet; then \
echo "Pas de changements à committer (gitversion n'a produit aucune diff)."; \
else \
git commit -m "chore(release): bump version via gitversion for $(V)"; \
fi; \
echo "==> Push de $$BRANCH sur origin"; \
git push -u origin "$$BRANCH"; \
echo "==> Terminé. Branche $$BRANCH live sur origin."
.PHONY: test release