diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7ea59a07..cc667275 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,28 +1,102 @@
-name: Dafda CI Release
+name: Dafda Release
on:
- push:
- branches:
- - master
- tags:
- - "*.*.*"
+ workflow_dispatch:
+ inputs:
+ version:
+ description: Release version (e.g. 1.2.3)
+ required: true
+ type: string
+ dry_run:
+ description: Dry run (build/test/pack only, no push/publish)
+ required: false
+ default: false
+ type: boolean
+
+permissions:
+ contents: write
jobs:
- build:
- name: Build NuGet package
+ release:
+ name: Build and publish release
runs-on: ubuntu-latest
+ env:
+ VERSION: ${{ github.event.inputs.version }}
+ DRY_RUN: ${{ inputs.dry_run }}
+
steps:
- - uses: actions/checkout@v1
- - name: Setup .NET Core
- uses: actions/setup-dotnet@v1
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- - name: Build package
- run: make package CONFIGURATION=Release
- - name: Push package
- if: startsWith(github.ref, 'refs/tags/')
+
+ - name: Validate release version
+ run: |
+ if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z\.-]+)?$ ]]; then
+ echo "Invalid version format: $VERSION"
+ exit 1
+ fi
+
+ - name: Ensure tag does not already exist
+ run: |
+ if git rev-parse "$VERSION" >/dev/null 2>&1; then
+ echo "Tag $VERSION already exists"
+ exit 1
+ fi
+
+ - name: Update project version
+ run: sed -i -E "s#.*#${VERSION}#" src/Dafda/Dafda.csproj
+
+ - name: Commit version and create tag
env:
- NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
+ GIT_USER_NAME: ${{ github.actor }}
+ GIT_USER_EMAIL: ${{ github.actor }}@users.noreply.github.com
run: |
- echo "Pushing new release with version ${GITHUB_REF:10}..."
- make push CONFIGURATION=Release
+ git config user.name "$GIT_USER_NAME"
+ git config user.email "$GIT_USER_EMAIL"
+
+ if git diff --quiet -- src/Dafda/Dafda.csproj; then
+ echo "Version is already set to $VERSION"
+ else
+ git add src/Dafda/Dafda.csproj
+ git commit -m "release: $VERSION"
+ fi
+
+ git tag "$VERSION"
+
+ if [ "$DRY_RUN" = "true" ]; then
+ echo "Dry run enabled: skipping git push"
+ else
+ git push origin "HEAD:${GITHUB_REF_NAME}" --follow-tags
+ fi
+
+ - name: Restore dependencies
+ run: dotnet restore src/Dafda.sln
+
+ - name: Build
+ run: dotnet build --configuration Release --no-restore src/Dafda.sln
+
+ - name: Test
+ run: dotnet test --configuration Release --no-build --verbosity normal src/Dafda.sln
+
+ - name: Pack NuGet package
+ run: dotnet pack src/Dafda/Dafda.csproj --configuration Release --no-build --output .output
+
+ - name: Push package to NuGet
+ if: ${{ !inputs.dry_run }}
+ env:
+ NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
+ run: dotnet nuget push ".output/Dafda.$VERSION.nupkg" --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY"
+
+ - name: Create GitHub Release
+ if: ${{ !inputs.dry_run }}
+ uses: softprops/action-gh-release@v2
+ with:
+ tag_name: ${{ env.VERSION }}
+ name: ${{ env.VERSION }}
+ generate_release_notes: true
+ files: .output/Dafda.${{ env.VERSION }}.nupkg
diff --git a/Makefile b/Makefile
deleted file mode 100644
index ce369ef5..00000000
--- a/Makefile
+++ /dev/null
@@ -1,85 +0,0 @@
-PACKAGE := Dafda
-PROJECT := $(CURDIR)/src/$(PACKAGE)/$(PACKAGE).csproj
-CONFIGURATION := Debug
-NUGET_API_KEY ?= $(shell git config --global nuget.token)
-BIN := $(CURDIR)/.output
-
-.PHONY: all
-all: build
-
-.PHONY: init
-init: restore build ## restore, build
-
-.PHONY: clean
-clean: ; $(info > Cleaning...) @ ## clean the build artifacts
- @rm -rf $(BIN)
-
-.PHONY: restore
-restore: ; $(info > Restoring dependencies...) @ ## restore project dependencies
- @cd src && dotnet restore
-
-.PHONY: build
-build: ; $(info > Building...) @ ## build the project
- @cd src && dotnet build --configuration $(CONFIGURATION)
-
-.PHONY: package
-package: clean restore build ; $(info > Packing $(PACKAGE)...) @ ## create the nuget package
- @cd src && dotnet pack --no-build --configuration $(CONFIGURATION) \
- --output $(BIN) \
- $(PROJECT)
-
-.PHONY: push
-push: ; $(info > Pushing $(PACKAGE)...) @ ## push the nuget package to nuget.org
- dotnet nuget push $(BIN)/$(PACKAGE).*.nupkg --source https://api.nuget.org/v3/index.json --api-key $(NUGET_API_KEY)
-
-.PHONY: version
-version: ## set the package version base on user input
- @echo "----------------------------------------------"
- @echo "- This action will update the:"
- @echo "- $(PROJECT)"
- @echo "- and create a new commit"
- @echo "----------------------------------------------"
- @echo
- @echo "Set the version of $(PACKAGE)"
- @echo " Current version: $$(sed -n -E 's,[[:blank:]]+(.+),\1,p' $(PROJECT))"
- @read -p " Enter new version: " version \
- && sed -E "s,(.+),$${version}," $(PROJECT) > $(PROJECT).new \
- && mv $(PROJECT).new $(PROJECT) \
- && git add $(PROJECT) \
- && git commit -m "update version to $${version}" 1>/dev/null
- @echo
- @echo "Version updated. Run e.g. 'make release' to tag according to latest version"
-
-.PHONY: release
-release: ## tag a release with latest version
- @case $$(uname) in \
- 'Darwin'|'Linux') \
- git tag $$(sed -n -E 's,[[:blank:]]+(.+),\1,p' $(PROJECT) | tr -d '\r') \
- ;; \
- *) \
- git tag $$(sed -n -E 's,[[:blank:]]+(.+),\1,p' $(PROJECT)) \
- ;; \
- esac
- @echo
- @echo "----------------------------------------------"
- @echo "- !! CAUTION !!"
- @echo "-"
- @echo "- The lastest version was tagged in git"
- @echo "----------------------------------------------"
- @echo
- @echo "Run e.g. 'git push --follow-tags' to release"
-
-docs-dev: ## edit documentation
- @cd docs && docker-compose up -d
-
-docs-deploy: ## deploy documentation to github pages
- @docker run --rm -it \
- -v ~/.ssh:/root/.ssh \
- -v ${PWD}:/docs \
- squidfunk/mkdocs-material:4.1.2 \
- gh-deploy --clean --config-file docs/mkdocs.yml
-
-.PHONY: help
-help:
- @grep -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
- awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
diff --git a/README.md b/README.md
index 7610ceb3..a79a3ebe 100644
--- a/README.md
+++ b/README.md
@@ -8,32 +8,23 @@ See [dfds.github.io/dafda](https://dfds.github.io/dafda/) for more the documenta
## Building and Releasing
-Dafda is build and released using a combination of `make` and [GitHub Actions](https://github.com/dfds/dafda/blob/master/.github/workflows/release.yml)
+Dafda is built and released using [GitHub Actions](https://github.com/dfds/dafda/blob/master/.github/workflows/release.yml)
-You will need the dotnet sdk. Refer to the [Microsoft Documentation](https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu) on how to install
+You will need the dotnet sdk for local development. Refer to the [Microsoft Documentation](https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu) on how to install.
Dafda is available on [NuGet](https://www.nuget.org/packages/Dafda/).
-### Versioning
+### Releases
-Run:
+Releases are created from the **Dafda Release** workflow in GitHub Actions.
-```bash
-make version
-```
-
-And input the new version of Dafda. This will update the `Dafda.csproj` with the new version.
-
-### NuGet Packages
+1. Open **Actions** in GitHub.
+2. Run **Dafda Release**.
+3. Enter the version to release (for example `1.2.3`).
-Run:
-
-```bash
-make release
-git push --follow-tags
-```
+The workflow will update `src/Dafda/Dafda.csproj`, create and push a tag, build/test/pack, publish to NuGet, and create a GitHub release.
-Will git tag with the current version (see [Versioning](#versioning), and GitHub Actions will take care of building, and pushing to NuGet.
+> Note: The repository must define a `NUGET_API_KEY` secret for publishing to nuget.org.
### Documentation
@@ -42,7 +33,8 @@ Documentation is written in markdown, and compiled to a static site using [MkDoc
#### Development
```bash
-make docs-dev
+cd docs
+docker-compose up -d
```
Uses `docker-compose` to run `MkDocs` development server, which watches changes to `/docs` folder. The website is available on [`http://localhost:8000`](`http://localhost:8000`).
@@ -50,7 +42,8 @@ Uses `docker-compose` to run `MkDocs` development server, which watches changes
#### Release
```bash
-make docs-deploy
+cd docs
+docker-compose run --rm mkdocs-deploy
```
Will build and deploy the static site to GitHub Pages.
diff --git a/azure-piplines.yml b/azure-piplines.yml
deleted file mode 100644
index 074364a1..00000000
--- a/azure-piplines.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-name: $(Build.BuildId)
-pool: Docker-pool
-trigger:
-- master
-
-steps:
-- bash: |
- make release push
- env:
- NUGET_API_KEY: $(NUGET_API_KEY)
- displayName: 'Build and push Nuget packages'
diff --git a/docs/README.md b/docs/README.md
index b8512c3f..be448496 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -23,5 +23,5 @@ docker run --rm -it -v ${PWD}:/docs squidfunk/mkdocs-material build
### Deploy documentation to GitHub Pages
```bash
-docker run --rm -it -v ~/.ssh:/root/.ssh -v ${PWD}:/docs squidfunk/mkdocs-material gh-deploy
+docker-compose run --rm mkdocs-deploy
```
diff --git a/docs/docker-compose.yml b/docs/docker-compose.yml
index 42d9698e..0ceb160b 100644
--- a/docs/docker-compose.yml
+++ b/docs/docker-compose.yml
@@ -7,3 +7,11 @@ services:
- 8000:8000
volumes:
- ${PWD}:/docs
+
+ mkdocs-deploy:
+ image: squidfunk/mkdocs-material:4.1.2
+ entrypoint: ["mkdocs"]
+ command: ["gh-deploy", "--clean", "--config-file", "mkdocs.yml"]
+ volumes:
+ - ${PWD}:/docs
+ - ~/.ssh:/root/.ssh
diff --git a/tester/README.md b/tester/README.md
index ff820d48..74a3d6ca 100644
--- a/tester/README.md
+++ b/tester/README.md
@@ -9,7 +9,7 @@ First create a local nuget package with your changes. Update the nuget reference
Run:
```bash
-make package
+dotnet pack src/Dafda/Dafda.csproj --configuration Release --output .output
```
To start a local Kafka instance, run: