-
Notifications
You must be signed in to change notification settings - Fork 57
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
Automatic changelog and version creation by triggering a new github release #143
base: rc-24.1.2
Are you sure you want to change the base?
Changes from all commits
e94ee8a
763c018
c93225f
e043fd2
d58d9b3
4d0664c
5757d32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
name: Build and Publish Add-on | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: [ 'v*.*.*' ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,6 @@ on: | |
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "0 0 * * *" | ||
workflow_dispatch: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Create Changelog and Release | ||
# Trigger on tags matching the format: v0.0.0, V0.0.0, or 0.0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to trigger on all of these? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with #159 i updated the versioning to follow ebusd's .. |
||
on: | ||
push: | ||
tags: | ||
- '[vV]*.*.*' | ||
- '*.*.*' | ||
|
||
permissions: | ||
contents: write | ||
actions: write | ||
|
||
jobs: | ||
release-notes: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/[email protected] | ||
|
||
- name: Extract release notes and version | ||
run: | | ||
RELEASE_INFO=$(curl -sL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
"https://api.github.com/repos/${{ github.repository }}/releases/latest") | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to fetch release info" | ||
exit 1 | ||
fi | ||
VERSION_WITH_PREFIX=$(echo "$RELEASE_INFO" | jq -r .tag_name) | ||
VERSION=$(echo "$VERSION_WITH_PREFIX" | sed 's/^[vV]//') | ||
NOTES=$(echo "$RELEASE_INFO" | jq -r .body) | ||
echo "VERSION_WITH_PREFIX=${VERSION_WITH_PREFIX}" >> $GITHUB_ENV | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
echo 'NOTES<<EOF' >> $GITHUB_ENV | ||
echo "$NOTES" >> $GITHUB_ENV | ||
echo 'EOF' >> $GITHUB_ENV | ||
cociweb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Append release notes to changelog.md | ||
run: | | ||
sed -i "/<!-- append new version here -->/ a ## ${{ env.VERSION_WITH_PREFIX }}\n${{ env.NOTES }}\n" \ | ||
"${{ github.workspace }}/ebusd/CHANGELOG.md" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to update CHANGELOG.md" | ||
exit 1 | ||
fi | ||
|
||
cociweb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Update version in config.yaml | ||
run: | | ||
sed -i "s/version: .*/version: \"${{ env.VERSION }}\"/" \ | ||
"${{ github.workspace }}/ebusd/config.yaml" | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to update config.yaml" | ||
exit 1 | ||
fi | ||
|
||
cociweb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Configure git | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
|
||
- name: Commit and push changes | ||
run: | | ||
VERSION=${{ env.VERSION }} | ||
git add ${{ github.workspace }}/ebusd/CHANGELOG.md ${{ github.workspace }}/ebusd/config.yaml | ||
git commit -m "Release version $VERSION" | ||
git push origin HEAD:main # Update 'main' to your branch name | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
cociweb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Trigger the builder workflow | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/actions/workflows/builder.yaml/dispatches \ | ||
-d '{"ref":"main"}' | ||
cociweb marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we also don't need this.