1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00

Merge pull request #771 from Zokrates/add-changelog

Add changelog scripts
This commit is contained in:
Thibaut Schaeffer 2021-03-30 16:27:48 +02:00 committed by GitHub
commit 1fdcff373a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 119 additions and 0 deletions

View file

@ -0,0 +1,14 @@
name: Pull request changelog check
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
jobs:
build:
if: ${{ !(contains(github.event.pull_request.labels.*.name, 'changelog-not-required')) }}
name: Run changelog check
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v2
- name: Changelog check
run: ./scripts/changelog-check.sh

20
CHANGELOG.md Normal file
View file

@ -0,0 +1,20 @@
# Changelog
All notable changes to this project will be documented in this file.
## [Unreleased]
https://github.com/Zokrates/ZoKrates/compare/master...develop
## [0.6.4] - 2021-03-19
### Release
- https://github.com/Zokrates/ZoKrates/releases/tag/0.6.4
### Changes
- re-include embeds for a slightly cheaper sha256
- remove array ssa
- add flag to allow unconstrained variables
- better flattening of conjunctions
- put backends behind features
- accept any assignee in multidef
- minor performance and stability improvements
For older releases and changes, visit https://github.com/Zokrates/ZoKrates/releases.

14
changelogs/README.md Normal file
View file

@ -0,0 +1,14 @@
## Adding a changelog
Pull request authors are expected to include a changelog file explaining the changes introduced by the pull request.
The changelog file should be a new file created in the `changelogs/unreleased` folder.
The file should follow the naming convention of `pr-username` and the contents of the file
should be your text for the changelog.
### Example
```
changelogs/unreleased # folder to place changelogs
101-username # your changelog file (pull request #101 by @username)
```
Any user-facing change must have a changelog entry. If a pull request does not warrant a changelog, the CI check for a changelog can be skipped by applying a `changelog-not-required` label.

View file

24
scripts/changelog-check.sh Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
set +x
if [ -z "$CI" ]; then
echo "This script is intended to be run only on Github Actions." >&2
exit 1
fi
CHANGELOG_PATH='changelogs/unreleased'
pr_number=$(echo $GITHUB_REF | cut -d / -f 3)
changelog="${CHANGELOG_PATH}/${pr_number}-*"
if [ ! -f "$changelog" ]; then
echo "Pull request #${pr_number:-?} is missing a changelog. Please add a changelog to ${CHANGELOG_PATH}."
exit 1
fi
cl_diff=$(git diff --exit-code $GITHUB_HEAD_REF CHANGELOG.md)
if [ -n "$cl_diff" ]; then
echo "Pull requests should not directly modify the main CHANGELOG.md file. For more information, please read changelogs/README.md"
exit 1
fi

47
scripts/changelog.sh Executable file
View file

@ -0,0 +1,47 @@
#!/bin/bash
# This script is intended for maintainers only to generate changelog markdown before new releases.
# The generated markdown can be added to the main CHANGELOG.md file located at the root of the repository.
set -e
if [ -z "$1" ]; then
echo "Usage: $0 TAG" >&2
exit 1
fi
function join { local IFS="$1"; shift; echo "$*"; }
function qdate
{
if type -p gdate > /dev/null; then
gdate "$@";
else
date "$@";
fi
}
CHANGELOG_PATH='changelogs/unreleased'
tag=$1
unreleased=$(ls -t ${CHANGELOG_PATH})
echo -e "Generating CHANGELOG markdown from ${CHANGELOG_PATH}\n"
cat << EOT
## [${tag}] - $(qdate '+%Y-%m-%d')
### Release
- https://github.com/Zokrates/ZoKrates/releases/tag/${tag}
### Changes
EOT
for file in $unreleased
do
IFS=$'-' read -ra entry <<< "$file"
contents=$(cat ${CHANGELOG_PATH}/${file} | tr '\n' ' ')
author=$(join '-' ${entry[@]:1})
echo "- ${contents} (#${entry[0]}, @${author})"
done
echo -e "\nCopy and paste the markdown above to the appropriate CHANGELOG file."
echo "Be sure to run: git rm ${CHANGELOG_PATH}/*"