-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: "release version number (3 digits)" | ||
required: true | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build | ||
run: bash ${GITHUB_WORKSPACE}/tools/release.sh ${{ inputs.tag }} | ||
|
||
- name: Release | ||
uses: softprops/[email protected] | ||
with: | ||
tag_name: ${{ inputs.tag }} | ||
name: dracut-${{ inputs.tag }} | ||
body_path: ${{ github.workspace }}/release.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
LAST_VERSION=$(git describe --abbrev=0 --tags --always 2> /dev/null) | ||
|
||
# CONTRIBUTORS | ||
printf "#### Contributors\n\n" > CONTRIBUTORS.md | ||
git log | git shortlog "$LAST_VERSION.." --numbered --summary -e | while read -r a rest || [ -n "$rest" ]; do echo "- $rest"; done >> CONTRIBUTORS.md | ||
|
||
# Update AUTHORS | ||
# shellcheck disable=SC2034 | ||
git log | git shortlog --numbered --summary -e | while read -r a rest || [ -n "$rest" ]; do echo "$rest"; done > AUTHORS | ||
|
||
# Update NEWS.md | ||
cargo install clog-cli | ||
head -2 NEWS.md > NEWS_header.md | ||
tail +2 NEWS.md > NEWS_body.md | ||
printf "dracut-%s\n==========\n" "$1" > NEWS_header_new.md | ||
cat CONTRIBUTORS.md NEWS_body.md > NEWS_body_with_conttributors.md | ||
|
||
# clog will always output both the new release and old release information together | ||
clog -F --infile NEWS_body_with_conttributors.md -r https://github.com/dracutdevs/dracut | sed '1,2d' > NEWS_body_full.md | ||
|
||
# Use diff to separate new release information and remove repeated empty lines | ||
diff NEWS_body_with_conttributors.md NEWS_body_full.md | grep -e ^\>\ | sed s/^\>\ // | cat -s > NEWS_body_new.md | ||
cat NEWS_header.md NEWS_header_new.md NEWS_body_new.md NEWS_body_with_conttributors.md > NEWS.md | ||
|
||
# message for https://github.com/dracutdevs/dracut/releases/tag | ||
cat -s NEWS_body_new.md CONTRIBUTORS.md > release.md | ||
|
||
# Check in AUTHORS and NEWS.md | ||
git config user.name "Dracut Release Bot" | ||
git config user.email "<>" | ||
git commit -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS | ||
git push origin master | ||
git tag "$1" -m "$1" | ||
git push --tags |