Skip to content

0.2.6

0.2.6 #16

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/[email protected]
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|<a href='https://github.com/janhq/nitro/releases/download/v.*-linux-amd64-cuda.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-linux-amd64-cuda.tar.gz'>|" README.md
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-linux-amd64.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-linux-amd64.tar.gz'>|" README.md
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-mac-amd64.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-mac-amd64.tar.gz'>|" README.md
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-mac-arm64.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-mac-arm64.tar.gz'>|" README.md
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-win-amd64-cuda.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-win-amd64-cuda.tar.gz'>|" README.md
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-win-amd64.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-win-amd64.tar.gz'>|" README.md
- name: Commit and Push changes
if: github.event_name == 'release'
run: |
git config --global user.email "[email protected]"
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