Fix changelog (#5155)

* Pass git ref explicitely

* Include a db migration section to the changelog
This commit is contained in:
Chevdor
2022-03-22 09:55:21 +01:00
committed by GitHub
parent 848065b61e
commit 168dc6e5cd
8 changed files with 71 additions and 30 deletions
+1 -2
View File
@@ -108,7 +108,6 @@ jobs:
KUSAMA_DIGEST: ${{ github.workspace}}/kusama-srtool-json/kusama_srtool_output.json
POLKADOT_DIGEST: ${{ github.workspace}}/polkadot-srtool-json/polkadot_srtool_output.json
PRE_RELEASE: ${{ github.event.inputs.pre_release }}
HIDE_SRTOOL_ROCOCO: false
run: |
find ${{env.GITHUB_WORKSPACE}} -type f -name "*_srtool_output.json"
ls -al $ROCOCO_DIGEST
@@ -118,7 +117,7 @@ jobs:
cd polkadot/scripts/changelog
./bin/changelog
./bin/changelog ${GITHUB_REF}
ls -al release-notes.md
ls -al context.json
+7 -9
View File
@@ -5,18 +5,18 @@ Currently, the changelog is built locally. It will be moved to CI once labels st
For now, a bit of preparation is required before you can run the script:
- fetch the srtool digests
- store them under the `digests` folder as `<chain>-srtool-digest.json`
- ensure the `.env` file is up to date with correct information
- ensure the `.env` file is up to date with correct information. See below for an example
The content of the release notes is generated from the template files under the `scripts/changelog/templates` folder. For readability and maintenance, the template is split into several small snippets.
Run:
```
./bin/changelog <ref_since> [<ref_until>=HEAD]
./bin/changelog <ref_until> [<ref_since>]
```
For instance:
```
./bin/changelog statemine-v5.0.0
./bin/changelog v0.9.18
```
A file called `release-notes.md` will be generated and can be used for the release.
@@ -29,10 +29,7 @@ You may use the following ENV for testing:
RUSTC_STABLE="rustc 1.56.1 (59eed8a2a 2021-11-01)"
RUSTC_NIGHTLY="rustc 1.57.0-nightly (51e514c0f 2021-09-12)"
PRE_RELEASE=true
HIDE_SRTOOL_ROCOCO=true
HIDE_SRTOOL_SHELL=true
REF1=statemine-v5.0.0
REF2=HEAD
DEBUG=1
NO_CACHE=1
```
@@ -45,6 +42,7 @@ Currently, the considered labels are:
- Priority: C<N> labels
- Audit: D<N> labels
- E4 => new host function
- E2 => database migration
- B0 => silent, not showing up
- B1-releasenotes (misc unless other labels)
- B5-client (client changes)
@@ -61,11 +59,11 @@ decide which label will be considered.
The following command allows **Hot Reload**:
```
fswatch templates -e ".*\.md$" | xargs -n1 -I{} ./bin/changelog statemine-v5.0.0
fswatch templates -e ".*\.md$" | xargs -n1 -I{} ./bin/changelog v0.9.18
```
### Caching
By default, if the changelog data from Github is already present, the calls to the Github API will be skipped
and the local version of the data will be used. This is much faster.
If you know that some labels have changed in Github, you probably want to refresh the data.
You can then either delete manually the `cumulus.json` file or `export NO_CACHE=1` to force refreshing the data.
If you know that some labels have changed in Github, you will want to refresh the data.
You can then either delete manually the `<chain>.json` file or `export NO_CACHE=1` to force refreshing the data.
+8 -3
View File
@@ -3,7 +3,11 @@
# frozen_string_literal: true
# call for instance as:
# ./bin/changelog v0.9.13
# ./bin/changelog <to> [<from>] [<output_file>]
# for instance, for the release notes of v1.2.3:
# ./bin/changelog v1.2.3
# or
# ./bin/changelog v1.2.3 v1.2.2
#
# You may set the ENV NO_CACHE to force fetching from Github
# You should also ensure you set the ENV: GITHUB_TOKEN
@@ -21,8 +25,9 @@ repo = 'polkadot'
gh_polkadot = SubRef.new(format('%<owner>s/%<repo>s', { owner: owner, repo: repo }))
last_release_ref = gh_polkadot.get_last_ref()
polkadot_ref1 = ARGV[0] || last_release_ref
polkadot_ref2 = ARGV[1] || 'HEAD'
polkadot_ref2 = ARGV[0] || 'HEAD'
polkadot_ref1 = ARGV[1] || last_release_ref
output = ARGV[2] || 'release-notes.md'
ENV['REF1'] = polkadot_ref1
@@ -1,5 +1,5 @@
{% import "high_priority.md.tera" as m_p -%}
## Global Priority
## Upgrade Priority
{%- set polkadot_prio = 0 -%}
{%- set substrate_prio = 0 -%}
@@ -0,0 +1,26 @@
{%- import "change.md.tera" as m_c %}
{%- set_global db_migration_count = 0 -%}
## Database Migrations
{% for pr in changes | sort(attribute="merged_at") -%}
{%- if pr.meta.B and pr.meta.B.value == 0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.E and pr.meta.E.value == 2 -%}
{%- set_global db_migration_count = db_migration_count + 1 -%}
- {{ m_c::change(c=pr) }}
{% endif -%}
{% endif -%}
{% endfor -%}
{%- if db_migration_count == 0 -%}
No Database migration detected in this release.
{% else %}
There is {{ db_migration_count }} database migration(s) in this release.
Database migrations are operations bringing your database to the latest stand.
Some migrations may break compatibility and making a backup of your database is highly recommended.
{%- endif %}
@@ -0,0 +1,25 @@
{%- import "change.md.tera" as m_c %}
{%- set_global runtime_migration_count = 0 -%}
## Runtime Migrations
{% for pr in changes | sort(attribute="merged_at") -%}
{%- if pr.meta.B and pr.meta.B.value == 0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.E and pr.meta.E.value == 1 -%}
{%- set_global runtime_migration_count = runtime_migration_count + 1 -%}
- {{ m_c::change(c=pr) }}
{% endif -%}
{% endif -%}
{% endfor -%}
{%- if runtime_migration_count == 0 -%}
No Runtime migration detected in this release.
{% else %}
There is {{ runtime_migration_count }} runtime migration(s) in this release.
Runtime migrations are operations running once during a runtime upgrade.
{%- endif %}
@@ -1,14 +0,0 @@
{%- import "change.md.tera" as m_c %}
## Migrations
{% for pr in changes | sort(attribute="merged_at") -%}
{%- if pr.meta.B and pr.meta.B.value == 0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.E and pr.meta.E.value == 1 -%}
- {{ m_c::change(c=pr) }}
{% endif -%}
{% endif -%}
{% endfor -%}
@@ -21,7 +21,9 @@ This release contains the changes from `{{ env.REF1 }}` to `{{ env.REF2 }}`.
{% include "compiler.md.tera" -%}
{% include "migrations.md.tera" -%}
{% include "migrations-db.md.tera" -%}
{% include "migrations-runtime.md.tera" -%}
{% include "runtimes.md.tera" -%}