Skip to content

Commit

Permalink
[INFRA] Automate tag and files update (#145)
Browse files Browse the repository at this point in the history
Add new workflow for the release: `release.yml` including the following
steps (in order):
  - unprotect the branch
  - generate the new version with `create-new-semantic-version` (based on the latest git tag)
  - update the README.md and DESCRIPTION files with the new version
  - commit the changes
  - tag, then push the commit and tag
  - update the DESCRIPTION file with the new development version
  - commit and push it
  - protect the branch again
  • Loading branch information
csouchet authored Nov 22, 2022
1 parent 1cae15a commit 47878c8
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 31 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Release

on:
workflow_dispatch:
inputs:
type:
description: 'New version type [major | minor | patch]'
required: true
default: 'patch'
jobs:
bumpVersion:
runs-on: ubuntu-20.04
steps:
- run: |
echo "New version type: ${{ github.event.inputs.type }}"
- name: Branch Protection Bot - Temporarily disable "include administrators" branch protection
uses: benjefferies/[email protected]
if: always()
with:
access_token: ${{ secrets.GH_RELEASE_TOKEN }}
enforce_admins: false
branch: main

- name: Setup checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_RELEASE_TOKEN }}

- name: Config git
run: |
git config --local user.email "[email protected]"
git config --local user.name "process-analytics-bot"
git config pull.rebase true
- name: Checkout main
run: git checkout main && git pull --tag

- name: Generate new version
id: release_version
uses: zwaldowski/semver-release-action@v3
with:
dry_run: true
bump: ${{ inputs.type }}
prefix: v
github_token: ${{ secrets.GH_RELEASE_TOKEN }}

- name: Update with the release version
run: |
CURRENT_VERSION=$(grep Version DESCRIPTION | sed 's/Version: \(.*\).9000/\1/g')
sed -i -E "s/$CURRENT_VERSION/${{ steps.release_version.outputs.version }}/g" README.md
sed -i -E 's/Version: .*/Version: ${{ steps.release_version.outputs.version }}/g' DESCRIPTION
- name: Commit with the release version
run: |
git add README.md
git add DESCRIPTION
git commit -m "[RELEASE] Set the release version to ${{ steps.release_version.outputs.version }}"
git push
- name: Tag ${{ steps.release_version.outputs.version }}
run: |
git tag -a ${{ steps.release_version.outputs.version_tag }} -m "[RELEASE] ${{ steps.release_version.outputs.version }}"
git push && git push --tags
- name: Update with the development version
run: |-
sed -i -E 's/Version: .*/Version: ${{ steps.release_version.outputs.version }}.9000/g' DESCRIPTION
- name: Commit with the development version
run: |
git add DESCRIPTION
git commit -m "[RELEASE] Set the development version to ${{ steps.release_version.outputs.version }}.9000"
git push
- name: Branch Protection Bot - Reenable "include administrators" branch protection
uses: benjefferies/[email protected]
if: always() # Force to always run this step to ensure "include administrators" is always turned back on
with:
access_token: ${{ secrets.GH_RELEASE_TOKEN }}
enforce_admins: true
branch: main
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: bpmnVisualization
Type: Package
Title: Visualize Process Execution Data on BPMN (Business Process Model and Notation) Diagrams
Version: 0.2.1
Version: 0.2.1.9000
Authors@R: c(person("Celine", "Souchet", role = c("aut", "cre"), email = "[email protected]"),
person("Thomas", "Bouffard", role = "aut"))
Description: To visualize the execution data of the processes on BPMN diagrams, using overlays, style customization and interactions, with BPMN Visualization.
Expand Down
72 changes: 42 additions & 30 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ A PR can only be merged into master by a maintainer, if all of these conditions

Maintainers need to perform the following actions **in the order described here** to push out a release.

### Verify the version in files

**NOTE**: this is a very manual process today. For improvements, see [#131](https://github.com/process-analytics/bpmn-visualization-R/issues/131)

Check that the files are using the version to be released:
- [DESCRIPTION](./DESCRIPTION)
- [README](./README.md)

Create a new PR (it must have the `skip-changelog` label as we don't want it to appear in the release notes) and merge it,
if some files require changes. The PR/commit message should be `[RELEASE] Set version to x.y.z`.

### GitHub issues and milestones update

**Note:** we always put issues related to a version in a Milestone whose name matches the version.
Expand All @@ -38,37 +27,60 @@ if some files require changes. The PR/commit message should be `[RELEASE] Set ve

### Prepare the GitHub Release Notes

- Open [github releases](https://github.com/process-analytics/bpmn-visualization-R/releases)
- Open [GitHub releases](https://github.com/process-analytics/bpmn-visualization-R/releases)
- Create a new draft release and name it `Next` (the name is not relevant and will be replaced automatically later).
This ensures that development can continue without impacting the writing of the content of the in progress release. That way,
if a PR is merged, `release-drafter` will update the `Next` draft release keeping the in-progress release untouched.
- The draft release for the newly tagged version should already exist:
- [release-drafter](https://github.com/release-drafter/release-drafter) creates or updates draft release for the
next version each time a pull request is merged to the `master` branch.
- create a new release if it is missing or rename the existing one to match.
- Assign the new tag as release target and save the draft (this should have already been managed by `release-drafter`)
- [release-drafter](https://github.com/release-drafter/release-drafter) creates or updates draft release for the
next version each time a pull request is merged to the `master` branch.
- create a new release if it is missing or rename the existing one to match.
- Ensure that `This is a pre-release` is unchecked (except if we are releasing alpha, beta, rc, ...)
- In the release description (check previous releases as a source of inspiration)
- If the bpmn-visualization TypeScript library was updated, add a phrase about it (see [Release 0.2.1](https://github.com/process-analytics/bpmn-visualization-R/releases/tag/v0.2.1) for instance.): `The R package now uses [[email protected]](https://github.com/process-analytics/bpmn-visualization-js/releases/tag/v0.26.2).`
- put screenshots/gif of the new features.
- At any time, you can save the draft.

### Release on GitHub (tag)
### Initiate the Release

- Open the [Release GitHub Actions](https://github.com/process-analytics/bpmn-visualization-R/actions/workflows/release.yml)
- Click on the 'Run workflow' dropdown located on the right side of the page
- Provide parameter value for New version type (default is patch, but you can choose one of the [major | minor | patch])
- Click on the button 'Run workflow'
- Make sure job execution was successful by checking the status
- The new git tag should have been created and available on GitHub

___

- Open the draft release note in [github releases](https://github.com/process-analytics/bpmn-visualization-R/releases)
- Verify the tag version as the same as the release note.
- Published the release **only when you are done** with the release content.
### Manual procedure

### Use a development version
⚠️⚠️⚠️ _**Only if the GitHub job that release this repository fails after manual re-run!**_ ⚠️⚠️⚠️

**NOTE**: this is a very manual process today. For improvements, see [#131](https://github.com/process-analytics/bpmn-visualization-R/issues/131)
#### Verify the version in files

Update the [DESCRIPTION](./DESCRIPTION) file to use a development version (for more explanations, see the [R documentation](https://r-pkgs.org/release.html#post-release):
- bump the current version. For instance, if the released version was `0.3.0`, bump it to `0.3.1`
- add a postfix to the version to state that it is a development version. For instance, `0.3.1.9000`
Check that the files are using the version to be released:
- [DESCRIPTION](./DESCRIPTION)
- [README](./README.md)

Create a new PR (it must have the `skip-changelog` label as we don't want it to appear in the release notes) and merge it,
if some files require changes. The PR/commit message should be `[RELEASE] Set version to x.y.z`.

#### Use a development version

Add the `.9000` suffix to the `Version` field in the [DESCRIPTION](./DESCRIPTION) file to indicate that this is a development version (for more explanations, see the [R documentation](https://r-pkgs.org/release.html#post-release)).
For instance, if the released version was `0.3.0`, the `Version` field in the `DESCRIPTION` file should be `0.3.O.9000`.

Create a new PR (it must have the `skip-changelog` label as we don't want it to appear in the release notes) and merge it.
The PR/commit message should be `[INFRA] Set the development version to x.y.z`.
The PR/commit message should be `[INFRA] Set the development version to x.y.z.9000`.

___

#### Publish the GitHub Release Notes

- Open the draft release note in [GitHub releases](https://github.com/process-analytics/bpmn-visualization-R/releases)
- In the release description (check previous releases as a source of inspiration)
- If the bpmn-visualization TypeScript library was updated, add a phrase about it (see [Release 0.2.1](https://github.com/process-analytics/bpmn-visualization-R/releases/tag/v0.2.1) for instance.): `The R package now uses [[email protected]](https://github.com/process-analytics/bpmn-visualization-js/releases/tag/v0.26.2).`
- put screenshots/gif of the new features.
- At any time, you can save the draft.
- **Only when you are done**:
- Assign the tag of the new version as release target and save the draft (doing it as later as possible ensure that `release-drafter` doesn't interfer with the writing of the Release Notes)
- Publish the release.

### Publish the new version on CRAN

Expand Down

0 comments on commit 47878c8

Please sign in to comment.