mirror of
https://github.com/awfufu/frp-pkgs.git
synced 2026-03-01 04:49:44 +08:00
ci: refactor version check
This commit is contained in:
21
.github/workflows/build_rpm.yml
vendored
21
.github/workflows/build_rpm.yml
vendored
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user