-
Notifications
You must be signed in to change notification settings - Fork 1
Updater for HA addon version #152
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
Open
LukBelter
wants to merge
12
commits into
dev
Choose a base branch
from
feature/hass_addon_update
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d206dfd
Updater for HA addon version
LukBelter 2a361f9
Update PAT name
LukBelter fa7dd00
extend function to update multiple addon tracks
LukBelter a723083
wipe using bco user within docker
DivineThreepwood 450ebb9
cleanup bco submodules
DivineThreepwood 15d8c84
Merge branch 'feature/hass_addon_update' of https://github.com/openba…
DivineThreepwood f18ef5f
remove if for testing
LukBelter c0137f5
Merge branch 'feature/hass_addon_update' of https://github.com/openba…
LukBelter 21d38fe
fix indentation
LukBelter 526a900
fix indentation
LukBelter 1c9cac8
fix input name
LukBelter cd53f06
fix startsWith
LukBelter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,105 @@ | ||
| name: Home Assistant Add-ons Update | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| version: | ||
| description: 'The version to set for the add-ons' | ||
| required: false | ||
| type: string | ||
| default: "" | ||
| addon: | ||
| description: 'The add-on to update' | ||
| required: true | ||
| type: string | ||
| tags: | ||
| description: 'The tags associated with the version' | ||
| required: false | ||
| type: string | ||
| default: "" | ||
| track: | ||
| description: 'The track associated with the version' | ||
| required: false | ||
| type: string | ||
| default: "" | ||
| secrets: | ||
| CI_GITHUB_TOKEN: | ||
| description: 'CI GitHub token' | ||
| required: true | ||
|
|
||
| jobs: | ||
| update-addons: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout addon repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| token: ${{ secrets.CI_GITHUB_TOKEN }} | ||
| repository: openbase/homeassistant.addons.bco | ||
| path: addons-repo | ||
|
|
||
| - name: Dig up tag | ||
| id: dig-up-tag | ||
| env: | ||
| TAGS: "${{ inputs.tags }}" | ||
| TRACK: "${{ inputs.track }}" | ||
| run: | | ||
| echo "Received TAGS: $TAGS" | ||
| echo "Searching for tag for track: $TRACK" | ||
|
|
||
| if [ -n "$TRACK" ]; then | ||
| MATCHED_TAG=$(printf "%s\n" "$LIST" \ | ||
| | sed -n "s/.*:${TRACK}+\([^[:space:]]*\).*/${TRACK}+\\1/p" \ | ||
| | sort -u \ | ||
| | head -n1) | ||
| if [ -n "$MATCHED_TAG" ]; then | ||
| echo "Found matching tag: $MATCHED_TAG" | ||
| echo "SELECTED_TAG=$MATCHED_TAG" >> $GITHUB_OUTPUT | ||
| exit 0 | ||
| fi | ||
| echo "No tag found for track '$TRACK'. Exiting with error." | ||
| exit 1 | ||
| else | ||
| echo "No track specified, skipping tag selection." | ||
| echo "SELECTED_TAG="" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Update add-on versions | ||
| env: | ||
| ADDON: "${{ inputs.addon }}" | ||
| TRACK: "${{ inputs.track }}" | ||
| GIT_USERNAME: "Minou [bot]" | ||
| GIT_EMAIL: "minou[bot]@users.noreply.github.com" | ||
| run: | | ||
|
|
||
| if [ -z $TRACK ]; then | ||
| echo "No track specified, using default folder." | ||
| if [ -z "${{ inputs.version }}" ]; then | ||
| echo "No version specified, exiting with error." | ||
| exit 1 | ||
| fi | ||
| VERSION="${{ inputs.version }}" | ||
| ADDON_DIR="${ADDON}" | ||
| else | ||
| echo "Track specified: ${TRACK}, using ${TRACK} folder." | ||
| VERSION="${{ steps.dig-up-tag.outputs.SELECTED_TAG }}" | ||
| ADDON_DIR="${ADDON}-${TRACK}" | ||
| fi | ||
|
|
||
| cd addons-repo/$ADDON_DIR | ||
|
|
||
| # Update version in config.yaml | ||
| sed -i "s/^version: .*/version: $VERSION/" config.yaml | ||
|
|
||
| # Commit and push changes | ||
| git config user.name "$GIT_USERNAME" | ||
| git config user.email "$GIT_EMAIL" | ||
| git add config.yaml | ||
| git commit -m "Update add-on $ADDONS_DIR version to $VERSION" || { | ||
| echo "No changes to commit" | ||
| exit 0 | ||
| } | ||
|
|
||
| git push | ||
|
|
||
| echo "✅ Add-on $ADDON_DIR version updated to $VERSION and changes pushed." |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.