mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-12-24 12:37:53 +08:00
fix: 自动替换和更新goecs.sh脚本中的最新tag
This commit is contained in:
22
.github/workflows/main.yaml
vendored
22
.github/workflows/main.yaml
vendored
@@ -40,3 +40,25 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GHT }}
|
||||
GOPRIVATE: github.com/oneclickvirt/security
|
||||
|
||||
- name: Update goecs.sh with new version
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
VERSION="${GITHUB_REF#refs/tags/v}"
|
||||
FILE="goecs.sh"
|
||||
BRANCH="master"
|
||||
# Checkout master branch
|
||||
git fetch origin $BRANCH:$BRANCH
|
||||
git switch $BRANCH
|
||||
# Replace version in goecs.sh
|
||||
sed -i "s/\(_yellow \"Unable to get version info, using default version \).*\(\".*\)/\1$VERSION\2/" "$FILE"
|
||||
sed -i "s/\(ECS_VERSION=\"\).*\(\"\)/\1$VERSION\2/" "$FILE"
|
||||
# Commit and push
|
||||
git config user.name "github-actions"
|
||||
git config user.email "github-actions@github.com"
|
||||
git add "$FILE"
|
||||
git commit -m "chore: update ECS_VERSION to $VERSION in goecs.sh"
|
||||
git push origin $BRANCH
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GHT }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user