Skip to content

Update README with Release Version #5

Update README with Release Version

Update README with Release Version #5

Workflow file for this run

name: Update README with Release Version
on:
release:
types: [published]
workflow_dispatch: # Adds manual trigger
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
token: ${{ secrets.PAT_TOKEN }} # Use PAT_TOKEN for checkout
- name: Determine Latest Version
id: get-latest-version
run: |
if [ "${{ github.event_name }}" = "release" ]; then
# Use the release tag if triggered by a release
latest_version="${{ github.event.release.tag_name }}"
else
# For manual dispatch, fetch the latest release tag using GitHub API
latest_version=$(curl -s -H "Authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
https://api.github.com/repos/WH1T3-E4GL3/gixposed/releases/latest | jq -r .tag_name)
fi
echo "Latest version: $latest_version"
# Strip the 'v' if it exists
deb_file_version="${latest_version#v}"
echo "latest_version=$latest_version" >> $GITHUB_ENV
echo "deb_file_version=$deb_file_version" >> $GITHUB_ENV
- name: Update README.md with latest version
id: update-readme
run: |
deb_file="gixposed_${deb_file_version}.deb"
# Update README.md with the latest version and download link
sed -i "s|wget https://github.com/WH1T3-E4GL3/gixposed/releases/download/.*|wget https://github.com/WH1T3-E4GL3/gixposed/releases/download/${{ env.latest_version }}/${deb_file}|" README.md
sed -i "s|sudo dpkg -i .*|sudo dpkg -i ${deb_file}|" README.md
- name: Commit changes
env:
TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add README.md
git commit -m "Update README.md for release ${{ env.latest_version }}"
git push -u origin main # Ensure it pushes to the main branch