ci: refactor version check

This commit is contained in:
2026-01-25 19:09:15 +08:00
parent 23e83bb4ee
commit 61dd187a86
2 changed files with 9 additions and 12 deletions

View File

@@ -23,10 +23,15 @@ jobs:
run: |
LATEST_TAG=$(curl -s https://api.github.com/repos/fatedier/frp/releases/latest | jq -r .tag_name)
LATEST_VERSION=${LATEST_TAG#v}
echo "Latest version: $LATEST_VERSION"
echo "Latest upstream version: $LATEST_VERSION"
CURRENT_VERSION=$(cat latest_version.txt 2>/dev/null || echo "0.0.0")
echo "Current version: $CURRENT_VERSION"
CURRENT_TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
if [ "$CURRENT_TAG" == "null" ]; then
CURRENT_VERSION="0.0.0"
else
CURRENT_VERSION=${CURRENT_TAG#v}
fi
echo "Current repo version: $CURRENT_VERSION"
if [ "$LATEST_VERSION" == "$CURRENT_VERSION" ] && [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
echo "Already up to date."
@@ -191,12 +196,4 @@ jobs:
keep_files: true
commit_message: "Update repo for v${{ needs.check_version.outputs.version }}"
- name: Update version record
run: |
echo "${{ needs.check_version.outputs.version }}" > latest_version.txt
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global --add safe.directory '*'
git add latest_version.txt
git commit -m "Update to v${{ needs.check_version.outputs.version }}"
git push

View File