v3.8.4: icon fix + release packaging #27
Workflow file for this run
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
| name: Export Addon to Kodi Repository | |
| on: | |
| workflow_dispatch: # Allow manual triggering | |
| release: | |
| types: [published] | |
| jobs: | |
| export-addon: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout plugin.video.iptvxc | |
| uses: actions/checkout@v4 | |
| - name: Ensure REPO_PAT secret is set | |
| run: | | |
| if [ -z "${{ secrets.REPO_PAT }}" ]; then | |
| echo "::error::REPO_PAT secret is not set. Please create a Personal Access Token with repo scope and add it to this repository's Secrets as REPO_PAT." | |
| exit 1 | |
| fi | |
| - name: Checkout Kodi Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Nigel1992/kodi-repository | |
| path: kodi-repo | |
| token: ${{ secrets.REPO_PAT }} | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Get version and info from addon.xml | |
| id: get_info | |
| run: | | |
| python3 << 'PY' | |
| import os | |
| from xml.etree import ElementTree as ET | |
| # we run inside the checked-out addon repo directory, parse addon.xml directly | |
| tree = ET.parse('addon.xml') | |
| root = tree.getroot() | |
| version = root.get('version') | |
| description = root.find('.//description').text.strip() if root.find('.//description') is not None else '' | |
| # Extract first bullet of the changelog for this version | |
| changelog = '' | |
| try: | |
| with open('CHANGELOG.md','r') as f: | |
| lines = f.readlines() | |
| ver_header = None | |
| for i,l in enumerate(lines): | |
| if l.strip().startswith('##') and version in l: | |
| ver_header = i | |
| break | |
| if ver_header is not None: | |
| for l in lines[ver_header+1:ver_header+20]: | |
| s = l.strip() | |
| if s.startswith('-'): | |
| changelog = s.lstrip('- ').strip() | |
| break | |
| except Exception: | |
| changelog = '' | |
| print(f"version={version}", file=open(os.environ['GITHUB_OUTPUT'],'a')) | |
| print(f"description={description}", file=open(os.environ['GITHUB_OUTPUT'],'a')) | |
| print(f"news={changelog}", file=open(os.environ['GITHUB_OUTPUT'],'a')) | |
| PY | |
| - name: Delete existing addon files | |
| run: | | |
| rm -rf kodi-repo/repository.nigel1992/addons/plugin.video.iptvxc | |
| mkdir -p kodi-repo/repository.nigel1992/addons/plugin.video.iptvxc | |
| - name: Copy addon files | |
| run: | | |
| # copy addon files into the kodi-repo addon folder, excluding the kodi-repo working copy itself | |
| rsync -a --exclude='kodi-repo' --exclude='.git' ./ kodi-repo/repository.nigel1992/addons/plugin.video.iptvxc/ | |
| - name: Update Repository README | |
| run: | | |
| cd kodi-repo | |
| # Update version badge in README (attempt to replace any version badge pattern) | |
| sed -i "s/version-[0-9.]\+-brightgreen/version-${{ steps.get_info.outputs.version }}-brightgreen/" README.md || true | |
| # Update addon section under the heading for XCUI Streams (if present) | |
| awk -v ver="${{ steps.get_info.outputs.version }}" -v desc="${{ steps.get_info.outputs.description }}" -v news="${{ steps.get_info.outputs.news }}" ' | |
| /### XCUI Streams/{ | |
| print "" | |
| print "**Current Version:** " ver | |
| print "" | |
| print desc | |
| print "" | |
| print "**Latest Update:** " news | |
| print "" | |
| getline | |
| while($0 ~ /^[[:space:]]*$/ || $0 ~ /^\*\*Current Version:\*\*/ || $0 ~ /^\*\*Latest Update:\*\*/) getline | |
| } | |
| 1' README.md > README.md.tmp && mv README.md.tmp README.md || true | |
| - name: Commit and push changes | |
| run: | | |
| cd kodi-repo | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add repository.nigel1992/addons/plugin.video.iptvxc README.md || true | |
| git commit -m "Update plugin.video.iptvxc to version ${{ steps.get_info.outputs.version }}" || echo "No changes to commit" | |
| git push |