Skip to content

Commit

Permalink
add PR check, remove release candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
Licini committed Mar 8, 2022
1 parent f19e23b commit 61fc8f3
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 29 deletions.
19 changes: 4 additions & 15 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@ current_version = 0.2.0
message = Bump version to {new_version}
commit = True
tag = True
parse = ^
(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
(?:
(?P<release>rc)
(?:(?P<rc>\d+(?:\.\d+)*))?
)?
serialize =
{major}.{minor}.{patch}{release}{rc}
{major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = final
values =
rc
final

[bumpversion:file:setup.py]
search = version='{current_version}'
Expand All @@ -30,3 +15,7 @@ replace = release = '{new_version}'
[bumpversion:file:src/compas_fd/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'

[bumpversion:file:CHANGELOG.md]
search = Unreleased
replace = [{new_version}] {now:%Y-%m-%d}
3 changes: 2 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: compas-dev/compas-actions.docs@v1.3.0
- uses: compas-dev/compas-actions.docs@v1.4.1
id: docs
with:
dest: deploy
build_to_subfolder: true
test_docs: true

- name: Deploy docs
if: success() && steps.docs.outputs.commit_type != 'pull'
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: verify-pr-checklist
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
- master

jobs:
build:
name: Check Actions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Changelog check
uses: Zomzog/[email protected]
with:
fileName: CHANGELOG.md
checkNotification: Simple
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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).

## Unreleased

### Added
- Workflow for changelog check.

### Changed

### Removed
- Release candidate option.
20 changes: 7 additions & 13 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,26 +193,20 @@ def prepare_changelog(ctx):


@task(help={
'release_type': 'Type of release follows semver rules. Must be one of: major, minor, patch, major-rc, minor-rc, patch-rc, rc, release.'})
'release_type': 'Type of release follows semver rules. Must be one of: major, minor, patch.'})
def release(ctx, release_type):
"""Releases the project in one swift command!"""
if release_type not in ('patch', 'minor', 'major', 'major-rc', 'minor-rc', 'patch-rc', 'rc', 'release'):
raise Exit('The release type parameter is invalid.\nMust be one of: major, minor, patch, major-rc, minor-rc, patch-rc, rc, release')

is_rc = release_type.find('rc') >= 0
release_type = release_type.split('-')[0]
if release_type not in ('patch', 'minor', 'major'):
raise Exit('The release type parameter is invalid.\nMust be one of: major, minor, patch.')

# Run checks
ctx.run('invoke check')

# Bump version and git tag it
if is_rc:
ctx.run('bump2version %s --verbose' % release_type)
elif release_type == 'release':
ctx.run('bump2version release --verbose')
else:
ctx.run('bump2version %s --verbose --no-tag' % release_type)
ctx.run('bump2version release --verbose')
ctx.run('bump2version %s --verbose' % release_type)

# Prepare the change log for the next release
prepare_changelog(ctx)


@contextlib.contextmanager
Expand Down

0 comments on commit 61fc8f3

Please sign in to comment.