From 10f0bb46414c56481a8fb0e58a4d927f2c9b2235 Mon Sep 17 00:00:00 2001 From: Leo Date: Mon, 15 Jan 2024 21:20:57 +0100 Subject: [PATCH] Feature/changelog release (#131) --- .github/workflows/release.yml | 41 ++++++++++++++++++++ CHANGELOG.md | 12 ++++++ CONTRIBUTING.md | 73 +++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..764d690c2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +--- +name: release + +on: + push: + branches: + - main + tags: + - "v*.*.*" + + workflow_run: + workflows: ["pre-commit"] + types: + - completed + +jobs: + release: + name: Release Job + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install go (required for Changelog parsing) + uses: actions/setup-go@v4 + + - name: Parse CHANGELOG.md + run: | + GO111MODULE=on go install github.com/rcmachado/changelog@0.7.0 + changelog show "$GITHUB_REF_NAME" > ${{ github.workspace }}-CHANGELOG.txt + echo "Release note for $GITHUB_REF_NAME :" + cat ${{ github.workspace }}-CHANGELOG.txt + + - name: Release + uses: softprops/action-gh-release@v1 + with: + body_path: ${{ github.workspace }}-CHANGELOG.txt + files: | + LICENSE + CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..d0f5fca9a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# 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/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v-0.0.1](https://github.com/ansible/product-demos/-/tree/v-0.0.1) - 2024-01-12 + +### Added + +- Initial release ([1af584b4ea6d77812bfcb2f6474fee6ee1b13666](https://github.com/ansible/product-demos/-/commit/1af584b4ea6d77812bfcb2f6474fee6ee1b13666)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index adcbbabf9..d787d2935 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -72,3 +72,76 @@ Copy the token value and execute the following command: ```bash export ANSIBLE_GALAXY_SERVER_AH_TOKEN= ``` + +## Release Process + +We follow a structured release process for this project. Here are the steps involved: + +1. **Create a Release Branch:** + - Start by creating a new release branch from the `main` branch. + + ```bash + git checkout -b release/v- + ``` + +2. **Update Changelog:** + - Open the `CHANGELOG.md` file to manually add your change to the appropriate section. + - Our changelog follows the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format and includes the following categories of changes: + + - `Added` for new features. + - `Changed` for changes in existing functionality. + - `Deprecated` for features that will be removed in upcoming releases. + - `Fixed` for bug fixes. + - `Removed` for deprecated features that were removed. + - `Security` for security-related changes. + + - Add a new entry under the relevant category. Include a brief summary of the change and the merge request commit tag. + + ```markdown + ## [Unreleased] + + ### Added + + - New feature or enhancement ([Merge Request Commit](https://github.com/ansible/product-demos/-/commit/)) + ``` + + - Replace `` with the actual commit hash from the merge request. + +3. **Commit Changes:** + - Commit the changes made to the `CHANGELOG.md` file. + + ```bash + git add CHANGELOG.md + git commit -m "Update CHANGELOG for release " + ``` + +4. **Create a Pull Request:** + - Open a pull request from the release branch to the `main` branch. + +5. **Review and Merge:** + - Review the pull request and merge it into the `main` branch. + +6. **Tag the Release:** + - Once the pull request is merged, tag the release with the version number. + + ```bash + git tag -a v- -m "Release " + git push origin v- + ``` + +7. **Publish the Release:** + - After the successful completion of the pull request and merging into the `main` branch, an automatic GitHub Action will be triggered to publish the release. + + The GitHub Action will perform the following steps: + - Parse the `CHANGELOG.md` file. + - Generate a release note based on the changes. + - Attach relevant files (such as `LICENSE`, `CHANGELOG.md`, and the generated `CHANGELOG.txt`) to the GitHub Release. + + No manual intervention is required for this step; the GitHub Action will handle the release process automatically. + +8. **Cleanup:** + - Delete the release branch. + + ```bash + git branch -d release/v- + ```