Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts, .github/workflows: add script to extract changelog #689

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,27 @@ jobs:
run: |
git tag "${{matrix.crate}}/v${{matrix.version}}"
git push origin "${{matrix.crate}}/v${{matrix.version}}"
- name: Extract release notes
if: ${{ matrix.crate == 'containerd-shim-wasm' && !inputs.dry_run }}
run:
cd $GITHUB_WORKSPACE
./scripts/extract-changelog.sh ${{matrix.version}} > RELEASE_NOTES.md
cat RELEASE_NOTES.md
- name: Create release
if: ${{ !inputs.dry_run }}
run: |
gh release create 'refs/tags/${{matrix.crate}}/v${{matrix.version}}' --generate-notes
TAG_NAME=${{matrix.version}}
if [[ "$TAG_NAME" =~ .+-pre.* ]]; then
PRERELEASE_ARGS="--prerelease --latest=false"
else
PRERELEASE_ARGS=""
fi

gh release create 'refs/tags/${{matrix.crate}}/v${{matrix.version}}' \
--title "${{matrix.crate}}/v${{matrix.version}}" \
--notes-file RELEASE_NOTES.md \
--verify-tag \
$PRERELEASE_ARGS \
env:
GH_TOKEN: ${{ github.token }}
RELEASE_NAME: ${{ matrix.crate }}/v${{ matrix.version }}
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ containerd-shim-wasm = { path = "crates/containerd-shim-wasm", version = "0.4.0"

## Steps

1. Open a PR to bump crate versions and dependency versions in `Cargo.toml` for that crate
1. Open a PR to bump crate versions and dependency versions in `Cargo.toml` for that crate, and change the "Unreleased" section in the `CHANGELOG.md` to the new version.
2. PR can be merged after 2 LGTMs
3. Run the release workflow for the dependent crate. (e.g. `containerd-shim-wasm/v0.2.0` where `crate=containerd-shim-wasm` and `version=0.2.0`)
4. Wait for the release workflow to complete
Expand Down
12 changes: 12 additions & 0 deletions scripts/extract-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Inspired by https://stackoverflow.com/questions/40450238/parse-a-changelog-and-extract-changes-for-a-version
# This script will extract the changelog for a specific version from the CHANGELOG.md file
# Usage: ./extract-changelog.sh <version>
version=$1

awk -v ver="$version" '
/^## \[.*\]/ {
if (p) exit
if ($0 ~ "^## \\[" ver "\\]") { p=1; next }
}
p' crates/containerd-shim-wasm/CHANGELOG.md
Loading