e913e0988f
- Add SHELL declaration to Makefile for bash compatibility - Add check that release is run from main branch - Use jq instead of grep -oP for JSON parsing in release.yml - Move checkout before git ls-remote in create-release.yml - Add --allow-empty to commit in create-release.yml https://claude.ai/code/session_0158SxS2ATe6PL8zTpsoHRFn
31 lines
995 B
Makefile
31 lines
995 B
Makefile
SHELL := /usr/bin/env bash
|
|
.PHONY: test build package clean
|
|
|
|
PLUGIN_NAME := discord-rich-presence
|
|
WASM_FILE := plugin.wasm
|
|
|
|
test:
|
|
go test -race ./...
|
|
|
|
build:
|
|
tinygo build -opt=2 -scheduler=none -no-debug -o $(WASM_FILE) -target wasi -buildmode=c-shared .
|
|
|
|
package: build
|
|
zip $(PLUGIN_NAME).ndp $(WASM_FILE) manifest.json
|
|
|
|
clean:
|
|
rm -f $(WASM_FILE) $(PLUGIN_NAME).ndp
|
|
|
|
release: test
|
|
@if [[ ! "${V}" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$$ ]]; then echo "Usage: make release V=X.X.X"; exit 1; fi
|
|
go mod tidy
|
|
@if [ -n "`git status -s`" ]; then echo "\n\nThere are pending changes. Please commit or stash first"; exit 1; fi
|
|
@if [[ "$$(git branch --show-current)" != "main" ]]; then echo "Releases must be created from the main branch"; exit 1; fi
|
|
@# Update version in manifest.json
|
|
@sed -i 's/"version": *"[^"]*"/"version": "${V}"/' manifest.json
|
|
git add manifest.json
|
|
git commit -m "Release v${V}" --allow-empty --no-verify
|
|
git tag v${V}
|
|
git push origin main v${V} --no-verify
|
|
.PHONY: release
|