Skip to content

Commit 47878c8

Browse files
authored
[INFRA] Automate tag and files update (#145)
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
1 parent 1cae15a commit 47878c8

File tree

3 files changed

+125
-31
lines changed

3 files changed

+125
-31
lines changed

.github/workflows/release.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
type:
7+
description: 'New version type [major | minor | patch]'
8+
required: true
9+
default: 'patch'
10+
jobs:
11+
bumpVersion:
12+
runs-on: ubuntu-20.04
13+
steps:
14+
- run: |
15+
echo "New version type: ${{ github.event.inputs.type }}"
16+
17+
- name: Branch Protection Bot - Temporarily disable "include administrators" branch protection
18+
uses: benjefferies/branch-protection-bot@1.0.7
19+
if: always()
20+
with:
21+
access_token: ${{ secrets.GH_RELEASE_TOKEN }}
22+
enforce_admins: false
23+
branch: main
24+
25+
- name: Setup checkout
26+
uses: actions/checkout@v3
27+
with:
28+
token: ${{ secrets.GH_RELEASE_TOKEN }}
29+
30+
- name: Config git
31+
run: |
32+
git config --local user.email "62586190+process-analytics-bot@users.noreply.github.com"
33+
git config --local user.name "process-analytics-bot"
34+
git config pull.rebase true
35+
36+
- name: Checkout main
37+
run: git checkout main && git pull --tag
38+
39+
- name: Generate new version
40+
id: release_version
41+
uses: zwaldowski/semver-release-action@v3
42+
with:
43+
dry_run: true
44+
bump: ${{ inputs.type }}
45+
prefix: v
46+
github_token: ${{ secrets.GH_RELEASE_TOKEN }}
47+
48+
- name: Update with the release version
49+
run: |
50+
CURRENT_VERSION=$(grep Version DESCRIPTION | sed 's/Version: \(.*\).9000/\1/g')
51+
sed -i -E "s/$CURRENT_VERSION/${{ steps.release_version.outputs.version }}/g" README.md
52+
sed -i -E 's/Version: .*/Version: ${{ steps.release_version.outputs.version }}/g' DESCRIPTION
53+
54+
- name: Commit with the release version
55+
run: |
56+
git add README.md
57+
git add DESCRIPTION
58+
git commit -m "[RELEASE] Set the release version to ${{ steps.release_version.outputs.version }}"
59+
git push
60+
61+
- name: Tag ${{ steps.release_version.outputs.version }}
62+
run: |
63+
git tag -a ${{ steps.release_version.outputs.version_tag }} -m "[RELEASE] ${{ steps.release_version.outputs.version }}"
64+
git push && git push --tags
65+
66+
- name: Update with the development version
67+
run: |-
68+
sed -i -E 's/Version: .*/Version: ${{ steps.release_version.outputs.version }}.9000/g' DESCRIPTION
69+
70+
- name: Commit with the development version
71+
run: |
72+
git add DESCRIPTION
73+
git commit -m "[RELEASE] Set the development version to ${{ steps.release_version.outputs.version }}.9000"
74+
git push
75+
76+
- name: Branch Protection Bot - Reenable "include administrators" branch protection
77+
uses: benjefferies/branch-protection-bot@1.0.7
78+
if: always() # Force to always run this step to ensure "include administrators" is always turned back on
79+
with:
80+
access_token: ${{ secrets.GH_RELEASE_TOKEN }}
81+
enforce_admins: true
82+
branch: main

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: bpmnVisualization
22
Type: Package
33
Title: Visualize Process Execution Data on BPMN (Business Process Model and Notation) Diagrams
4-
Version: 0.2.1
4+
Version: 0.2.1.9000
55
Authors@R: c(person("Celine", "Souchet", role = c("aut", "cre"), email = "process.analytics.dev+CRAN@gmail.com"),
66
person("Thomas", "Bouffard", role = "aut"))
77
Description: To visualize the execution data of the processes on BPMN diagrams, using overlays, style customization and interactions, with BPMN Visualization.

MAINTAINERS.md

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,6 @@ A PR can only be merged into master by a maintainer, if all of these conditions
1616

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

19-
### Verify the version in files
20-
21-
**NOTE**: this is a very manual process today. For improvements, see [#131](https://github.com/process-analytics/bpmn-visualization-R/issues/131)
22-
23-
Check that the files are using the version to be released:
24-
- [DESCRIPTION](./DESCRIPTION)
25-
- [README](./README.md)
26-
27-
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,
28-
if some files require changes. The PR/commit message should be `[RELEASE] Set version to x.y.z`.
29-
3019
### GitHub issues and milestones update
3120

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

3928
### Prepare the GitHub Release Notes
4029

41-
- Open [github releases](https://github.com/process-analytics/bpmn-visualization-R/releases)
30+
- Open [GitHub releases](https://github.com/process-analytics/bpmn-visualization-R/releases)
4231
- Create a new draft release and name it `Next` (the name is not relevant and will be replaced automatically later).
4332
This ensures that development can continue without impacting the writing of the content of the in progress release. That way,
4433
if a PR is merged, `release-drafter` will update the `Next` draft release keeping the in-progress release untouched.
4534
- The draft release for the newly tagged version should already exist:
46-
- [release-drafter](https://github.com/release-drafter/release-drafter) creates or updates draft release for the
47-
next version each time a pull request is merged to the `master` branch.
48-
- create a new release if it is missing or rename the existing one to match.
49-
- Assign the new tag as release target and save the draft (this should have already been managed by `release-drafter`)
35+
- [release-drafter](https://github.com/release-drafter/release-drafter) creates or updates draft release for the
36+
next version each time a pull request is merged to the `master` branch.
37+
- create a new release if it is missing or rename the existing one to match.
5038
- Ensure that `This is a pre-release` is unchecked (except if we are releasing alpha, beta, rc, ...)
51-
- In the release description (check previous releases as a source of inspiration)
52-
- 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 [bpmn-visualization@0.26.2](https://github.com/process-analytics/bpmn-visualization-js/releases/tag/v0.26.2).`
53-
- put screenshots/gif of the new features.
54-
- At any time, you can save the draft.
5539

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

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

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

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

66-
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):
67-
- bump the current version. For instance, if the released version was `0.3.0`, bump it to `0.3.1`
68-
- add a postfix to the version to state that it is a development version. For instance, `0.3.1.9000`
57+
Check that the files are using the version to be released:
58+
- [DESCRIPTION](./DESCRIPTION)
59+
- [README](./README.md)
60+
61+
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,
62+
if some files require changes. The PR/commit message should be `[RELEASE] Set version to x.y.z`.
63+
64+
#### Use a development version
65+
66+
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)).
67+
For instance, if the released version was `0.3.0`, the `Version` field in the `DESCRIPTION` file should be `0.3.O.9000`.
6968

7069
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.
71-
The PR/commit message should be `[INFRA] Set the development version to x.y.z`.
70+
The PR/commit message should be `[INFRA] Set the development version to x.y.z.9000`.
71+
72+
___
73+
74+
#### Publish the GitHub Release Notes
75+
76+
- Open the draft release note in [GitHub releases](https://github.com/process-analytics/bpmn-visualization-R/releases)
77+
- In the release description (check previous releases as a source of inspiration)
78+
- 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 [bpmn-visualization@0.26.2](https://github.com/process-analytics/bpmn-visualization-js/releases/tag/v0.26.2).`
79+
- put screenshots/gif of the new features.
80+
- At any time, you can save the draft.
81+
- **Only when you are done**:
82+
- 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)
83+
- Publish the release.
7284

7385
### Publish the new version on CRAN
7486

0 commit comments

Comments
 (0)