diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5425c50 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,99 @@ +name: Create Release +# example: gh workflow run release.yml -f tag_name=v1.1.4 -f draft=true +on: + workflow_dispatch: + branches: + - main + inputs: + tag_name: + type: string + required: true + draft: + type: boolean + description: Draft release + default: false + prerelease: + type: boolean + description: Prerelease + default: false + +jobs: + prepare-release: + name: Prepare release + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Check naming convention + run: | + VERIF=$(echo ${{ github.event.inputs.tag_name }} | grep -E "^v([0-9]{1,}\.)([0-9]{1,}\.)([0-9]{1,})(-(alpha|beta)\.[0-9]{1,})?$") + if [ ! ${VERIF} ] + then + echo "Tag name '${{ github.event.inputs.tag_name }}' does not comply with naming convention vX.Y.Z" + exit 1 + fi + + - name: Set version number with v + run: | + echo "VERSION_NUMBER=$(echo ${{ github.event.inputs.tag_name }})" >> $GITHUB_ENV + + - name: Clone sources + uses: actions/checkout@v3 + + - name: Check version ${{ env.VERSION_NUMBER }} consistency in files + # Check CHANGELOG.md + run: | + + # Check top ## [VERSION_NUMBER](GITHUB_URL/releases/tag/VERSION_NUMBER) - yyyy-mm-dd in CHANGELOG.md + CURRENT_DATE=$(date +'%Y-%m-%d') + echo $CURRENT_DATE + CHANGELOG_VERSION=$(grep -o -E "## \[(.*)\].* - $CURRENT_DATE" CHANGELOG.md | head -1 | sed 's/ //g') + echo $CHANGELOG_VERSION + if [[ $CHANGELOG_VERSION == "##[${{ env.VERSION_NUMBER }}]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/${{ env.VERSION_NUMBER }})-$CURRENT_DATE" ]] + then + echo "CHANGELOG VERSION OK" + else + echo "CHANGELOG VERSION KO" + exit 1 + fi + + # Check top [_Compare with previous release_](GITHUB_URL/compare/LAST_TAG...VERSION_NUMBER) in CHANGELOG.md + COMPARISON=$(grep -oP "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/compare/\K(.*)$" CHANGELOG.md | head -1) + LAST_TAG=$(curl -Ls -o /dev/null -w %{url_effective} $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/latest | grep -oP "\/tag\/\K(.*)$") + if [[ $COMPARISON == "$LAST_TAG...${{ env.VERSION_NUMBER }})" ]] + then + echo "VERSION COMPARISON OK" + else + echo "VERSION COMPARISON KO" + echo $COMPARISON + echo "$LAST_TAG...${{ env.VERSION_NUMBER }})" + exit 1 + fi + + - name: Create Tag ${{ github.event.inputs.tag_name }} + uses: actions/github-script@v6 + with: + github-token: ${{ github.token }} + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: "refs/tags/${{ github.event.inputs.tag_name }}", + sha: context.sha + }) + + - name: Prepare release notes + run: | + # Retrieve release body and remove --- + VERSION_RELEASE_NOTES=$(awk -v ver="[${{ env.VERSION_NUMBER }}]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/${{ env.VERSION_NUMBER }})" '/^## / { if (p) { exit }; if ($2 == ver) { p=1; next} } p && NF' CHANGELOG.md | sed ':a;N;$!ba;s/\n---/ /g') + echo "$VERSION_RELEASE_NOTES" >> CHANGELOG.txt + + - name: Create release ${{ env.VERSION_NUMBER }} + uses: softprops/action-gh-release@v1 + with: + body_path: CHANGELOG.txt + name: ${{ env.VERSION_NUMBER }} + tag_name: ${{ github.event.inputs.tag_name }} + draft: ${{ github.event.inputs.draft }} + prerelease: ${{ github.event.inputs.prerelease }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3ea2fbd --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,64 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## SemVer public API + +The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) for this project is defined by the files `docker-compose.redis-commander.yaml` and `install.yaml`. + +--- + +## [v1.0.0](https://github.com/ddev/ddev-redis-commander/releases/tag/v1.0.0) - 2023-03-08 +[_Compare with previous release_](https://github.com/ddev/ddev-redis-commander/compare/v0.1.2...v1.0.0) + + +### Changed + +- Disable healthcheck in `docker-compose.redis-commander.yaml` + + +--- + +## [v0.1.2](https://github.com/ddev/ddev-redis-commander/releases/tag/v0.1.2) - 2023-02-03 +[_Compare with previous release_](https://github.com/ddev/ddev-redis-commander/compare/v0.1.1...v0.1.2) + + +### Changed + +- Remove docker-compose version in `docker-compose.redis-commander.yaml` +- Move from `drud` to `ddev` org + +--- + + +## [v0.1.1](https://github.com/ddev/ddev-redis-commander/releases/tag/v0.1.1) - 2022-06-17 +[_Compare with previous release_](https://github.com/ddev/ddev-redis-commander/compare/v0.1.0...v0.1.1) + + +### Changed + +- All files must contain #ddev-generated + +--- + +## [v0.1.0](https://github.com/ddev/ddev-redis-commander/releases/tag/v0.1.0) - 2022-03-22 +[_Compare with previous release_](https://github.com/ddev/ddev-redis-commander/compare/0.0.1...v0.1.0) + +### Added + +- Add dependency on `redis` container +- Add healthcheck timeout + +### Changed + +- Use multi-arch images + +--- + +## [0.0.1](https://github.com/ddev/ddev-redis-commander/releases/tag/0.0.1) - 2022-03-22 + +### Added +- Initial release diff --git a/README.md b/README.md index 2a22bb3..bce681f 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,4 @@ Then `ddev describe` will show you how to access the service at `https://