name: Update Download URLs
on:
release:
types:
- published
workflow_dispatch:
jobs:
update-readme:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: "0"
token: ${{ secrets.PAT_SERVICE_ACCOUNT }}
ref: main
- name: Get Latest Release
uses: pozetroninc/github-action-get-latest-release@v0.7.0
id: get-latest-release
with:
repository: ${{ github.repository }}
- name: Update Download URLs in README.md
run: |
echo "Latest Release: ${{ steps.get-latest-release.outputs.release }}"
tag=$(/bin/echo -n "${{ steps.get-latest-release.outputs.release }}")
echo "Tag: $tag"
# Remove the v prefix
release=${tag:1}
echo "Release: $release"
sed -i "s|||" README.md
sed -i "s|||" README.md
sed -i "s|||" README.md
sed -i "s|||" README.md
- name: Commit and Push changes
if: github.event_name == 'release'
run: |
git config --global user.email "service@jan.ai"
git config --global user.name "Service Account"
git add README.md
git commit -m "Update README.md with Stable Download URLs"
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main