From e123977ec637fbe3f83c742eb8534df610ea70d4 Mon Sep 17 00:00:00 2001 From: Carl Paton Date: Thu, 3 Jul 2025 21:58:00 +1200 Subject: [PATCH] semantic versioning --- .github/workflows/on-push.yml | 10 +++++++++- CHANGELOG.md | 12 ++++++++++-- CONTRIBUTING.md | 24 ++++++++++++++++++++++++ README.md | 2 +- WebApp/Views/Shared/_Layout.cshtml | 12 ++++++++++-- WebApp/WebApp.csproj | 1 + docs/local-setup.md | 12 ++++++------ 7 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index f524b19..4d91ffa 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -35,6 +35,12 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Extract version from csproj + id: get_version + run: | + VERSION=$(grep -m 1 '' ./WebApp/WebApp.csproj | sed -E 's/.*(.+)<\/Version>.*/\1/') + echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Build and push Docker image id: push uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 @@ -42,7 +48,9 @@ jobs: context: . file: ./Dockerfile push: true - tags: carlpaton/redis-administrator:latest + tags: | + carlpaton/redis-administrator:latest + carlpaton/redis-administrator:${{ steps.get_version.outputs.version }} # - name: Generate artifact attestation # uses: actions/attest-build-provenance@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index b92e25c..2b80243 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,18 @@ # Changelog -## [LATEST] - 2025-07-02 +## [1.0.0] - 2025-07-03 + +### Updates +- Migrate to .Net 7 +- Semantic versioning ### Breaking Changes - **Environment Variable Change:** The environment variable for configuring the Redis connection string has changed. **Old:** `REDIS_CONNECTION` **New:** `Database__ConnectionString` - Update your deployment scripts and Docker run commands to use `--env Database__ConnectionString=your_connection_string` instead of `--env REDIS_CONNECTION=your_connection_string` \ No newline at end of file + Update your deployment scripts and Docker run commands to use `--env Database__ConnectionString=your_connection_string` instead of `--env REDIS_CONNECTION=your_connection_string` + +## Past Versions + +All changes were pushed as [LATEST], they were simple changes like .Net Migrations and initial features like adding Redis types `String` and `SortedSet`. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e36f50e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,24 @@ +# Contributing to RedisAdministrator + +Thank you for your interest in contributing to RedisAdministrator! + +## How to Contribute + +1. **Fork the repository** and create your branch from `main`. +2. **Make your changes** with clear, descriptive commit messages. +3. **Update the version** in `WebApp/WebApp.csproj` if your changes introduce new features or breaking changes. +4. **Test your changes** to ensure nothing is broken. +5. **Submit a pull request** with a clear description of your changes and the motivation behind them. + +## Guidelines + +- Follow the existing code style and conventions. +- Write or update tests as appropriate. +- Document any new features or changes. +- Ensure your branch is up to date with the latest `master` branch before submitting your pull request. + +## Questions? + +If you have any questions, feel free to open an issue or reach out to the maintainers. + +Thank you for helping improve RedisAdministrator! diff --git a/README.md b/README.md index 7fbaa27..091b81b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ docker run --name red-admin -d -p 8081:80 --env Database__ConnectionString=red-s ## Contributing -Pull requests welcome! +Pull requests welcome, see [contributing](CONTRIBUTING.md) guidelines. - [Local Setup](./docs/local-setup.md) - [Redis Types](https://carlpaton.github.io/2022/02/redis-types/) diff --git a/WebApp/Views/Shared/_Layout.cshtml b/WebApp/Views/Shared/_Layout.cshtml index 3829c0f..cfa7f8d 100644 --- a/WebApp/Views/Shared/_Layout.cshtml +++ b/WebApp/Views/Shared/_Layout.cshtml @@ -74,12 +74,20 @@ + @{ + var assembly = System.Reflection.Assembly.GetExecutingAssembly(); + var infoVersionAttr = assembly.GetCustomAttributes(typeof(System.Reflection.AssemblyInformationalVersionAttribute), false) + .Cast() + .FirstOrDefault(); + var version = infoVersionAttr?.InformationalVersion?.Split('+')[0] ?? assembly.GetName().Version.ToString(); + } + diff --git a/WebApp/WebApp.csproj b/WebApp/WebApp.csproj index a1b0e37..f7d99f3 100644 --- a/WebApp/WebApp.csproj +++ b/WebApp/WebApp.csproj @@ -2,6 +2,7 @@ net7.0 + 1.0.0 diff --git a/docs/local-setup.md b/docs/local-setup.md index 1366daf..23e78cb 100644 --- a/docs/local-setup.md +++ b/docs/local-setup.md @@ -26,19 +26,19 @@ This deploys to https://hub.docker.com/, merging to master also triggers [this a I last did this with an integration from Github to Docker.com but they have since canned this feature and put it behind a paywall, I'll update here after I figure out how to do it. -1. build image with `docker build -t redis-administrator:develop .` -1. run it locally as `docker run --name red-admin-develop -d -p 8082:80 --network redis-bridge-network --env Database__ConnectionString=red-srv,allowAdmin=true redis-administrator:develop` +1. build image with `docker build -t redis-administrator:test .` +1. run it locally as `docker run --name red-admin-test -d -p 8082:80 --network redis-bridge-network --env Database__ConnectionString=red-srv,allowAdmin=true redis-administrator:test` 1. browse to http://localhost:8082 Now actually deploy 1. `docker login`, one time device confirmation opens docker.com for you to confirm -1. tag the image `docker tag redis-administrator:develop carlpaton/redis-administrator:develop` -1. now push `docker push carlpaton/redis-administrator:develop` +1. tag the image `docker tag redis-administrator:test carlpaton/redis-administrator:test` +1. now push `docker push carlpaton/redis-administrator:test` 1. browse and check the tag exists at https://hub.docker.com/r/carlpaton/redis-administrator/ Test the deployed image -1. delete local image tagged as `carlpaton/redis-administrator:develop` -1. run locally as `docker run --name red-admin-deploy -d -p 8083:80 --network redis-bridge-network --env Database__ConnectionString=red-srv,allowAdmin=true carlpaton/redis-administrator:develop` which should then pull from docker hub +1. delete local image tagged as `carlpaton/redis-administrator:test` +1. run locally as `docker run --name red-admin-deploy -d -p 8083:80 --network redis-bridge-network --env Database__ConnectionString=red-srv,allowAdmin=true carlpaton/redis-administrator:test` which should then pull from docker hub 1. browse to http://localhost:8083 \ No newline at end of file