Skip to content

Update README with latest downloads #23

Update README with latest downloads

Update README with latest downloads #23

name: Update README with latest downloads
on:
workflow_dispatch:
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Fetch latest release version
id: fetch-latest-release
uses: reloc8/action-latest-release-version@1.0.0
- name: Update README.md
run: |
TAG=${{ steps.fetch-latest-release.outputs.latest-release }}
WINDOWS="https://github.com/debba/storytel-player/releases/download/$TAG/Storytel-Player-Setup-${TAG#v}.exe"
MACOS="https://github.com/debba/storytel-player/releases/download/$TAG/Storytel-Player-${TAG#v}.dmg"
LINUX="https://github.com/debba/storytel-player/releases/download/$TAG/Storytel-Player-${TAG#v}.AppImage"
DOWNLOAD_SECTION="[![Windows](https://img.shields.io/badge/Windows-Download-blue?logo=windows)]($WINDOWS) \
[![macOS](https://img.shields.io/badge/macOS-Download-black?logo=apple)]($MACOS) \
[![Linux](https://img.shields.io/badge/Linux-Download-green?logo=linux)]($LINUX)"
# Replace section between markers
awk -v replacement="$DOWNLOAD_SECTION" '
BEGIN { in_section=0 }
/<!-- DOWNLOAD_SECTION_START -->/ {
print $0
print replacement
in_section=1
next
}
/<!-- DOWNLOAD_SECTION_END -->/ {
in_section=0
}
!in_section { print $0 }
' README.md > README.new
mv README.new README.md
- name: Commit and push changes
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add README.md
git commit -m "Update README with latest release ${{ steps.release.outputs.tag_name }}"
git push