-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ribir): 🤖 create a GitHub release for every alpha release
- Loading branch information
Showing
3 changed files
with
38 additions
and
9 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 |
---|---|---|
|
@@ -9,6 +9,12 @@ jobs: | |
release: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Exit if the branch is not master | ||
run: | | ||
if [[ "${{ github.ref }}" != "refs/heads/master" ]]; then | ||
echo "Branch is not master, exiting." | ||
exit 0 | ||
fi | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Required to count the commits | ||
|
@@ -39,9 +45,32 @@ jobs: | |
git config --global user.email "[email protected]" | ||
git config --global user.name "Bot@Ribir" | ||
- name: Run cargo release | ||
- name: Run cargo release to publish | ||
if: ${{ env.NEW_COMMIT_COUNT > 0 }} | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: release | ||
args: alpha --execute --no-confirm | ||
- name: Extract changelog | ||
if: ${{ env.NEW_COMMIT_COUNT > 0 }} | ||
run: | | ||
echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | ||
version=$(git describe --tags --abbrev=0 | grep -oP '(?<=v)\S*') | ||
echo "VERSION=$version" >> $GITHUB_ENV | ||
{ | ||
echo 'CHANGELOG<<delimiter-for-changelog' | ||
( | ||
grep -zoP "(?:## \[${version}\])[\s\S]*(?=\s+##[^#])" ./CHANGELOG.md \ | ||
|| grep -zoP "(?:## ${version})[\s\S]*(?=\s+<\!--)" ./CHANGELOG.md | ||
) \ | ||
| grep -zoP '\n[\s\S]*(?=\n)' | grep -zoP '\S[\s\S]*' \ | ||
| grep -aP '[\s\S]*' | sed -e '$a\' | ||
echo 'delimiter-for-changelog' | ||
} >> $GITHUB_ENV | ||
- name: Github release notes | ||
if: ${{ env.NEW_COMMIT_COUNT > 0 }} | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
prerelease: true | ||
body: ${{ env.CHANGELOG }} | ||
tag: ${{ env.TAG_NAME }} |
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
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