From 04aef97247a43f6e1fcaab0af3aed9364385e4b5 Mon Sep 17 00:00:00 2001 From: CxJuice <110189934+CxJuice@users.noreply.github.com> Date: Wed, 21 May 2025 19:00:55 +0800 Subject: [PATCH] Update main.yml --- .github/workflows/main.yml | 67 -------------------------------------- 1 file changed, 67 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bce36c9..8b13789 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,68 +1 @@ -on: - workflow_dispatch: - push: - branches: [ main ] -jobs: - bump_version: - name: Bump Version - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - name: Get changed files - id: getfile - run: | - files=$(git diff --name-only HEAD^ HEAD | tr '\n' ' ') - echo "::set-output name=files::$files" - - - name: Bump version number based on changed files - run: | - increment_version() { - echo "$1" | awk -F. '{$NF = $NF + 1;} 1' OFS=. - } - - changed_files="${{ steps.getfile.outputs.files }}" - temp_file=$(mktemp) - - cp json/locales/versions.json $temp_file - - # Use jq and increment_version function to bump version numbers based on changed files - if echo "$changed_files" | grep -q "addresses.json"; then - new_version=$(increment_version $(jq -r '.addresses' json/locales/versions.json)) - jq --arg v "$new_version" '.addresses = $v' $temp_file > json/temp.json && mv json/temp.json $temp_file - fi - if echo "$changed_files" | grep -q "concierge.json"; then - new_version=$(increment_version $(jq -r '.concierge' json/locales/versions.json)) - jq --arg v "$new_version" '.concierge = $v' $temp_file > json/temp.json && mv json/temp.json $temp_file - fi - if echo "$changed_files" | grep -q "hangar.json"; then - new_version=$(increment_version $(jq -r '.hangar' json/locales/versions.json)) - jq --arg v "$new_version" '.hangar = $v' $temp_file > json/temp.json && mv json/temp.json $temp_file - fi - if echo "$changed_files" | grep -q "orgs.json"; then - new_version=$(increment_version $(jq -r '.orgs' json/locales/versions.json)) - jq --arg v "$new_version" '.orgs = $v' $temp_file > json/temp.json && mv json/temp.json $temp_file - fi - if echo "$changed_files" | grep -q "zh-CN-rsi.json"; then - new_version=$(increment_version $(jq -r '.rsi' $temp_file)) - jq --arg v "$new_version" '.rsi = $v' $temp_file > json/temp.json && mv json/temp.json $temp_file - fi - if echo "$changed_files" | grep -q "zh-CN-uex.json"; then - new_version=$(increment_version $(jq -r '.uex' $temp_file)) - jq --arg v "$new_version" '.uex = $v' $temp_file > json/temp.json && mv json/temp.json $temp_file - fi - - mv $temp_file json/versions.json - - - name: Commit and push changes if there's an update - run: | - if [[ `git status --porcelain` ]]; then - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add json/locales/versions.json - git commit -m "Bump version number" && git push - fi