Skip to content

Commit 328d4be

Browse files
committed
update links
1 parent 3c42bd9 commit 328d4be

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/update-links.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Update Download Links
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
test_version:
9+
description: 'Version to test'
10+
required: true
11+
default: 'v1.0.0'
12+
13+
jobs:
14+
update-redirects:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Prepare Version Information
18+
id: prep_info
19+
run: |
20+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
21+
TAG="${{ github.event.inputs.test_version }}"
22+
else
23+
TAG="${{ github.event.release.tag_name }}"
24+
fi
25+
26+
echo "TAG_NAME=$TAG" >> $GITHUB_ENV
27+
CLEAN_VER=${TAG#v}
28+
echo "CLEAN_VERSION=$CLEAN_VER" >> $GITHUB_ENV
29+
30+
- name: Checkout Setup Repository
31+
uses: actions/checkout@v3
32+
with:
33+
repository: AudioShelf/setup
34+
token: ${{ secrets.ORG_ADMIN_TOKEN }}
35+
path: setup-repo
36+
37+
- name: Update Setup Redirect
38+
run: |
39+
cd setup-repo
40+
NEW_LINK="https://github.com/M-Rajabi-Dev/AudioShelf/releases/download/${{ env.TAG_NAME }}/AudioShelf-${{ env.CLEAN_VERSION }}-Win64-Setup.exe"
41+
42+
sed -i "s|url=.*\"|url=$NEW_LINK\"|g" index.html
43+
sed -i "s|window.location.href = \".*\";|window.location.href = \"$NEW_LINK\";|g" index.html
44+
45+
git config user.name "Link Updater Bot"
46+
git config user.email "[email protected]"
47+
git add index.html
48+
git commit -m "Update download link to ${{ env.TAG_NAME }}" || echo "No changes to commit"
49+
git push
50+
51+
- name: Checkout Portable Repository
52+
uses: actions/checkout@v3
53+
with:
54+
repository: AudioShelf/portable
55+
token: ${{ secrets.ORG_ADMIN_TOKEN }}
56+
path: portable-repo
57+
58+
- name: Update Portable Redirect
59+
run: |
60+
cd portable-repo
61+
NEW_LINK="https://github.com/M-Rajabi-Dev/AudioShelf/releases/download/${{ env.TAG_NAME }}/AudioShelf-${{ env.CLEAN_VERSION }}-Win64-Portable.zip"
62+
63+
sed -i "s|url=.*\"|url=$NEW_LINK\"|g" index.html
64+
sed -i "s|window.location.href = \".*\";|window.location.href = \"$NEW_LINK\";|g" index.html
65+
66+
git config user.name "Link Updater Bot"
67+
git config user.email "[email protected]"
68+
git add index.html
69+
git commit -m "Update download link to ${{ env.TAG_NAME }}" || echo "No changes to commit"
70+
git push

0 commit comments

Comments
 (0)