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

Automatic changelog and version creation by triggering a new github release #143

Draft
wants to merge 7 commits into
base: rc-24.1.2
Choose a base branch
from
Draft
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
4 changes: 0 additions & 4 deletions .github/workflows/builder.yaml
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:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches:
- main
Comment on lines 5 to 6
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branches:
- main

I guess we also don't need this.

pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/release-notes.yaml
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
Copy link
Collaborator

@tjorim tjorim Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to trigger on all of these?
I think for consistency we should stick to a single format.
Or maybe just switch to Calendar Versioning like HA itself did?

Copy link
Owner

Choose a reason for hiding this comment

The 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
3 changes: 1 addition & 2 deletions .github/workflows/tester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Build and Test Add-on
on:
push:
branches:
- '**'
- '!main'
- main
pull_request:
workflow_dispatch:

Expand Down
12 changes: 7 additions & 5 deletions ebusd/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->
cociweb marked this conversation as resolved.
Show resolved Hide resolved
## version: 23.2.6

<!-- append new version here -->
## 23.2.6

- Update HEALTHCHECK in Dockerfile to not use DNS [#126](https://github.com/LukasGrebe/ha-addons/issues/126) thanks @StCyr

## version: 23.2.5
## 23.2.5

- Revert required mode [#116](https://github.com/LukasGrebe/ha-addons/issues/116) thanks @tjorim

## version: 23.2.4
## 23.2.4

- added the option to store rotated logs in /config through s6-log [#102](https://github.com/LukasGrebe/ha-addons/issues/102) thanks @pvyleta

## version: 23.2.3
## 23.2.3

- fix Healthcheck. This should solve [#61](https://github.com/LukasGrebe/ha-addons/issues/61) thanks @cociweb

## version: 23.2.0
## 23.2.0
cociweb marked this conversation as resolved.
Show resolved Hide resolved

- Change build process to use pre-build containers. This should speed up the install of the addon as the addon does not need to be compiled from Supervisor before beeing run.
- EBUSd 23.2
Expand Down
Loading