-
Notifications
You must be signed in to change notification settings - Fork 4
51 lines (43 loc) · 1.87 KB
/
Copy pathreadme-downloads.yml
File metadata and controls
51 lines (43 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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) \
[]($MACOS) \
[]($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