Skip to content

Commit

Permalink
Merge pull request #11 from ryanrozich/update-gh-action-skip-version-…
Browse files Browse the repository at this point in the history
…commit-message
  • Loading branch information
ryanrozich authored May 5, 2024
2 parents 6e5bbc8 + a66dae9 commit e94dd92
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 20 deletions.
29 changes: 9 additions & 20 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,31 @@ jobs:
git diff main HEAD~1 --name-only > changes.txt
echo "::set-output name=status::$(grep -qvE '^docs/|^README.md|^\.env\.sample$|^config\.json\.sample$|^\.github/workflows/|\.bumpversion\.cfg$' changes.txt && echo 'code' || echo 'docs')"
# Conditional step based on changes
- name: Version Bump and Push
if: steps.determine_changes.outputs.status == 'code'
run: |
bump2version patch --config-file .bumpversion.cfg
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git push --tags
- name: Get last commit message
id: get-commit-message
run: echo "::set-output name=message::$(git log -1 --pretty=%B)"

- name: Determine version bump type
if: steps.determine_changes.outputs.status == 'code'
id: version-bump-type
run: |
echo "Commit message: ${{ steps.get-commit-message.outputs.message }}"
if echo "${{ steps.get-commit-message.outputs.message }}" | grep -q "MAJOR:"; then
echo "Commit message: ${{ github.event.head_commit.message }}"
if echo "${{ github.event.head_commit.message }}" | grep -q "\[skip version\]"; then
echo "::set-output name=type::skip"
elif echo "${{ github.event.head_commit.message }}" | grep -q "MAJOR:"; then
echo "::set-output name=type::major"
elif echo "${{ steps.get-commit-message.outputs.message }}" | grep -q "MINOR:"; then
elif echo "${{ github.event.head_commit.message }}" | grep -q "MINOR:"; then
echo "::set-output name=type::minor"
else
echo "::set-output name=type::patch"
fi
- name: Bump version
if: steps.determine_changes.outputs.status == 'code'
run: bumpversion ${{ steps.version-bump-type.outputs.type }}

- name: Push changes
if: steps.determine_changes.outputs.status == 'code'
- name: Version Bump and Push
if: steps.version-bump-type.outputs.type != 'skip'
run: |
bump2version ${{ steps.version-bump-type.outputs.type }} --config-file .bumpversion.cfg
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git push && git push --tags
git push --tags
- name: Build and publish
if: steps.determine_changes.outputs.status == 'code'
Expand Down
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,48 @@ snowflake-dbml --config-file config.json > output.dbml

Contributions are welcome! Whether it's tweaking code, enhancing documentation, or reporting bugs, we'd love to see your pull requests. Let's make this tool even better together!

Here’s a refined section for your `README.md` to document all special commit message keywords, including instructions for controlling version increments. This section can be integrated into your GitHub repository documentation:

### Commit Message Keywords

In our continuous integration process, commit message keywords play a crucial role in determining the nature of changes and the corresponding actions in our deployment pipeline. Below are the keywords that you can use to control versioning and deployment:

#### Keywords:

- **`[skip version]`**
- **Purpose**: Prevents any version bump or tag creation. Use this keyword for commits that make non-functional changes, such as updates to documentation, that do not warrant a new version number.
- **Example**:
```bash
git commit -m "Update README [skip version]"
```

- **`MAJOR:`**
- **Purpose**: Triggers a major version bump, indicating backward-incompatible changes that require this level of escalation.
- **Example**:
```bash
git commit -m "MAJOR: Redesign database schema for scalability"
```

- **`MINOR:`**
- **Purpose**: Triggers a minor version bump, suitable for backward-compatible functionality enhancements.
- **Example**:
```bash
git commit -m "MINOR: Add new analytics features"
```

- **`PATCH:`** (default if no keyword is specified)
- **Purpose**: Applies a patch version bump, typically for bug fixes and minor changes that don’t add new features or break existing ones.
- **Example**:
```bash
git commit -m "PATCH: Fix data loading issue"
```

#### Workflow Integration:

These keywords are evaluated in our GitHub Actions workflow to decide the type of version bump or to skip versioning entirely. It ensures that our versioning reflects the nature of changes accurately, maintaining consistency and predictability in our release process.

By using these keywords appropriately in your commit messages, you help maintain the integrity of the versioning process and ensure that each release is meaningful.

## License

Licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Expand Down

0 comments on commit e94dd92

Please sign in to comment.