Update Download Links #1
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: Update Download Links | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| test_version: | |
| description: 'Version to test' | |
| required: true | |
| default: 'v1.0.0' | |
| jobs: | |
| update-redirects: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Prepare Version Information | |
| id: prep_info | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| TAG="${{ github.event.inputs.test_version }}" | |
| else | |
| TAG="${{ github.event.release.tag_name }}" | |
| fi | |
| echo "TAG_NAME=$TAG" >> $GITHUB_ENV | |
| CLEAN_VER=${TAG#v} | |
| echo "CLEAN_VERSION=$CLEAN_VER" >> $GITHUB_ENV | |
| - name: Checkout Setup Repository | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: AudioShelf/setup | |
| token: ${{ secrets.ORG_ADMIN_TOKEN }} | |
| path: setup-repo | |
| - name: Update Setup Redirect | |
| run: | | |
| cd setup-repo | |
| NEW_LINK="https://github.com/M-Rajabi-Dev/AudioShelf/releases/download/${{ env.TAG_NAME }}/AudioShelf-${{ env.CLEAN_VERSION }}-Win64-Setup.exe" | |
| sed -i "s|url=.*\"|url=$NEW_LINK\"|g" index.html | |
| sed -i "s|window.location.href = \".*\";|window.location.href = \"$NEW_LINK\";|g" index.html | |
| git config user.name "Link Updater Bot" | |
| git config user.email "[email protected]" | |
| git add index.html | |
| git commit -m "Update download link to ${{ env.TAG_NAME }}" || echo "No changes to commit" | |
| git push | |
| - name: Checkout Portable Repository | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: AudioShelf/portable | |
| token: ${{ secrets.ORG_ADMIN_TOKEN }} | |
| path: portable-repo | |
| - name: Update Portable Redirect | |
| run: | | |
| cd portable-repo | |
| NEW_LINK="https://github.com/M-Rajabi-Dev/AudioShelf/releases/download/${{ env.TAG_NAME }}/AudioShelf-${{ env.CLEAN_VERSION }}-Win64-Portable.zip" | |
| sed -i "s|url=.*\"|url=$NEW_LINK\"|g" index.html | |
| sed -i "s|window.location.href = \".*\";|window.location.href = \"$NEW_LINK\";|g" index.html | |
| git config user.name "Link Updater Bot" | |
| git config user.email "[email protected]" | |
| git add index.html | |
| git commit -m "Update download link to ${{ env.TAG_NAME }}" || echo "No changes to commit" | |
| git push |