This repository demonstrates an automated process for semantic versioning and releasing a project using GitHub Actions. The workflow is triggered when a pull request is merged into the master branch, and it performs the following actions:
- Computes the next semantic version based on conventional commit messages.
- Updates the version in
package.json
. - Commits the change and pushes it to the master branch.
- Creates a new Git tag for the new version.
- Generates and publishes a GitHub release with release notes.
Here's an overview of the main workflow file create-new-tag-and-release.yml
:
- Checkout Code: Checks out the code from the repository.
- Setup Node.js: Sets up the specified Node.js environment.
- Install Dependencies: Installs the necessary dependencies using
npm ci
. - Determine Next Version: Runs a custom script to calculate the next semantic version based on commit messages.
- Setup Git User: Configures the Git user for subsequent operations.
- Update package.json: Updates the
package.json
file with the new version. - Commit Changes: Commits the changes to
package.json
. - Push Changes: Pushes the changes and tags to the remote repository.
- Create Release: Creates a GitHub release with automatically generated release notes.
If you wish to experiment with or adapt this workflow:
- Fork the Repository: Click the "Fork" button at the top right of this page.
- Clone Your Fork: Clone your fork to your local machine.
- Make Changes: Modify the code, workflow, or scripts as needed.
- Commit and Push: Commit your changes and push them to GitHub.
- Create a Pull Request: Open a pull request to merge your changes into the master branch. Once merged, the workflow will be triggered.
Contributions, issues, and feature requests are welcome! Feel free to open an issue or submit a pull request.
This project is open-source and available under the MIT License.
- Special thanks to LukaPrebil for inspiration and help in shaping this project.
For any questions or feedback, please open an issue on GitHub.