The releaseUnifiedPolicyProvider.sh script automates the process of creating a new release for the terraform-provider-unifiedpolicy.
- Clean working tree (no uncommitted changes)
- Access to push to the repository
- Git configured with appropriate credentials
./releaseUnifiedPolicyProvider.shThe script will:
- Fetch and display the latest version from GitHub
- Prompt you to enter the new version number
- Ask for confirmation at each step
For CI/CD or automation:
NEW_VERSION=1.0.1 ./releaseUnifiedPolicyProvider.sh -yor
export NEW_VERSION=1.0.1
./releaseUnifiedPolicyProvider.sh -yThe -y flag automatically answers "yes" to all prompts.
The script performs the following steps:
- Version Check: Fetches the latest stable version from GitHub
- Input Validation: Validates the new version follows SemVer (e.g., 1.2.3)
- Safety Checks:
- Ensures working tree is clean
- Verifies the tag doesn't already exist
- Git Workflow:
- Checks out the default branch (main)
- Pulls the latest code
- Creates a new release branch (e.g.,
v1.0.1) - Pushes the branch to origin
- Creates a new tag (e.g.,
v1.0.1) - Pushes the tag to origin
Versions must follow SemVer format: MAJOR.MINOR.PATCH
Examples:
- ✅
1.0.0 - ✅
v1.0.0(will be normalized tov1.0.0) - ✅
1.2.3 - ❌
1.0(missing patch version) - ❌
1.0.0-beta(pre-release versions not supported by this script)
Once the tag is pushed, the GitHub Actions workflow (.github/workflows/release.yml) will:
- Trigger automatically on tag push
- Build the provider for multiple platforms
- Sign the release with GPG
- Create a GitHub release
- Upload artifacts to the release
- Publish to Terraform Registry and OpenTofu Registry
$ ./releaseUnifiedPolicyProvider.sh
--- Fetching Latest Stable Provider Versions ---
Latest version for terraform-provider-unifiedpolicy: v1.0.0
-------------------------------------
Using provider: terraform-provider-unifiedpolicy
Please enter the new version number (e.g., 1.2.3): 1.0.1
--- Starting release process for provider 'terraform-provider-unifiedpolicy' and version v1.0.1 ---
About to checkout branch 'main'...
Proceed to checkout 'main'? (y/n) y
About to pull latest code from 'main'...
Proceed to pull from 'main'? (y/n) y
About to create and checkout new release branch: v1.0.1...
Proceed to create branch 'v1.0.1'? (y/n) y
About to push new branch to origin: v1.0.1...
Proceed to push branch 'v1.0.1' to origin? (y/n) y
About to create new tag: v1.0.1...
Proceed to create tag 'v1.0.1'? (y/n) y
About to push new tag to origin: v1.0.1...
Proceed to push tag 'v1.0.1' to origin? (y/n) y
--- Release process completed successfully for terraform-provider-unifiedpolicy! ---Error: "Your working tree has uncommitted changes."
Solution:
- Commit or stash your changes
- Or answer "y" when prompted to proceed anyway (not recommended)
Error: "Tag v1.0.1 already exists locally or on origin."
Solution:
- Choose a different version number
- Or delete the existing tag if it was created in error:
git tag -d v1.0.1 git push origin :refs/tags/v1.0.1
Error: Unable to push to origin
Solution:
- Verify you have push access to the repository
- Check your Git credentials
- Ensure you're authenticated with GitHub
If you prefer to do it manually without the script:
# 1. Checkout and update main branch
git checkout main
git pull --ff-only
# 2. Create release branch
git checkout -b v1.0.1
# 3. Push branch
git push -u origin v1.0.1
# 4. Create and push tag
git tag v1.0.1
git push origin tag v1.0.1After the release is created:
- Monitor the GitHub Actions workflow for successful completion
- Verify the release appears on the Releases page
- Verify the provider is available on:
- Update documentation if needed
- Announce the release to stakeholders
This project follows Semantic Versioning:
- MAJOR: Incompatible API changes, breaking changes
- MINOR: New features, backwards-compatible additions
- PATCH: Bug fixes, backwards-compatible fixes
| Change Type | Version Bump |
|---|---|
| Breaking schema change | MAJOR |
| New resource/data source | MINOR |
| New attribute (optional) | MINOR |
| Bug fix | PATCH |
| Documentation update | PATCH |
| Dependency update (non-breaking) | PATCH |
Before running the release script:
-
Update CHANGELOG.md
- Add new version header with date and tested versions
- Document all changes (features, bug fixes, breaking changes)
- Include issue/PR references
-
Update Documentation
- Run
make docto regenerate documentation - Verify examples are up to date
- Run
-
Run Tests
make test make acceptance -
Verify Build
make build
- The script auto-detects the default branch (main or master)
- Each step requires confirmation unless
-yflag is used - The script will exit immediately if any command fails (set -e)
- Tags pushed to GitHub trigger the automated release workflow