Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/mark-stable-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Update Releases

on:
workflow_dispatch:
inputs:
stable_version:
description: 'Version to mark as stable (e.g., 1.7.2)'
required: false
inactive_release:
description: 'Version to mark as inactive (e.g., 1.5)'
required: false

jobs:
update-releases:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Packages
run: sudo apt-get update && sudo apt-get install -y jq

- name: Get Releases
id: get_releases
run: |
curl -sSL https://api.github.com/repos/longhorn/longhorn/releases | jq '.[]' > releases.json

- name: Mark Stable Version
if: github.event.inputs.stable_version != ''
run: |
stable_version="${{ github.event.inputs.stable_version }}"
echo "Input stable version: $stable_version"

# Check if the FULL version exists in README.md
if grep -q "| ${stable_version} |" README.md; then #Match full version
echo "Found full version in README.md: ${stable_version}"
# Use sed to add "(Stable)" to the correct cell in the table
if sed -i "s/| ${stable_version} |/| ${stable_version} (Stable) |/" README.md; then
echo "Successfully marked ${stable_version} as stable."
grep "| ${stable_version} (Stable) |" README.md # Verify the change
else
echo "Failed to mark ${stable_version} as stable! Check the sed command."
exit 1
fi
else
echo "Full version ${stable_version} not found in README.md, cannot mark as stable."
exit 1
fi

- name: Mark Inactive Release
if: github.event.inputs.inactive_release != ''
run: |
inactive_release="${{ github.event.inputs.inactive_release }}"
echo "Input inactive version: $inactive_release"
if grep -q "| ${inactive_release} |" README.md; then
echo "Found version number in README.md: ${inactive_release}"
if sed -i "s/| ${inactive_release} |.*| ✅ |/| ${inactive_release} |.*| |/" README.md; then
echo "Successfully marked ${inactive_release} as inactive."
grep "| ${inactive_release} |.*| |" README.md
else
echo "Failed to mark ${inactive_release} as inactive! Check the sed command."
exit 1
fi
else
echo "Version number ${inactive_release} not found in README.md, cannot mark as inactive."
exit 1
fi

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Update Releases information"
branch: ${{ github.ref }}
Loading