diff --git a/.github/bin/dist-github-release.sh b/.github/bin/dist-github-release.sh index 16c794879d..430179cf02 100755 --- a/.github/bin/dist-github-release.sh +++ b/.github/bin/dist-github-release.sh @@ -16,6 +16,13 @@ elif [ "${GITHUB_REF:0:10}" != "refs/tags/" ]; then fi tag="${GITHUB_REF#refs/*/}" +if [ ! -f obj/release_note.txt ]; then + { + echo "obj/release_note.txt file is missing." + echo "dist:release-note action must be run first." + } > /dev/stderr + exit 1 +fi if command -v apk; then apk add --no-cache ca-certificates @@ -36,7 +43,7 @@ while ! "$(dirname "$0")/github-release.sh" info \ --repo "$github_repo" \ --tag "$tag" \ --name "$tag" \ - --description "" || true + --description - < obj/release_note.txt || true trial=$((trial + 1)) if [[ "$trial" -gt 5 ]]; then break; fi done diff --git a/.github/bin/dist-release-note.sh b/.github/bin/dist-release-note.sh new file mode 100644 index 0000000000..e54d8bccd2 --- /dev/null +++ b/.github/bin/dist-release-note.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Extract a release note from the given changelog file. +# Note that this script is intended to be run by GitHub Actions. +set -e + +if [ "$1" = "" ]; then + echo "A changelog file path is missing." > /dev/stderr + exit 1 +elif [ "$2" = "" ]; then + echo "An output path is missing." > /dev/stderr + exit 1 +fi + +tag="${GITHUB_REF#refs/*/}" +wget -O /tmp/submark \ + https://github.com/dahlia/submark/releases/download/0.2.0/submark-linux-x86_64 +chmod +x /tmp/submark +/tmp/submark \ + -o "$2" \ + -iO \ + --h2 "Version $tag" \ + "$1" +rm /tmp/submark + +if ! grep -E '\S' "$2" > /dev/null; then + echo "There is no section for the version $tag." > /dev/stderr + exit 1 +elif grep -i "to be released" "$2"; then + echo 'Release date should be shown on the release note.' > /dev/stderr + exit 1 +fi diff --git a/.github/workflows/check-changelog.yml b/.github/workflows/check-changelog.yml new file mode 100644 index 0000000000..0b5046d6da --- /dev/null +++ b/.github/workflows/check-changelog.yml @@ -0,0 +1,15 @@ +name: check-changelog +on: + pull_request: + types: [assigned, opened, synchronize, reopened, labeled, unlabeled] + branches: + - main + - development + - 'rc-*' +jobs: + check-changelog: + runs-on: ubuntu-latest + steps: + - uses: tarides/changelog-check-action@v2 + with: + changelog: CHANGES.md diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index da7f3aabb8..4126367fb6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -15,6 +15,11 @@ jobs: with: dotnet-version: 6.0.x - run: .github/bin/dist-pack.sh + - run: .github/bin/dist-release-note.sh CHANGES.md obj/release_note.txt + - uses: actions/upload-artifact@main + with: + name: dist-obj + path: obj/ - run: .github/bin/dist-github-release.sh env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000000..4862ec9370 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,25 @@ +Lib9c changelog +=============== + +Version v200221 +--------------- + +To be released. + +### Deprecated APIs + +### Backward-incompatible API changes + +### Backward-incompatible network protocol changes + +### Backward-incompatible storage format changes + +### Added APIs + +### Behavioral changes + +### Bug fixes + +### Dependencies + +### CLI tools