diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index e5a1938..f3e85d5 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -17,26 +17,16 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Get latest git release - id: get-latest-release - run: | - LATEST_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1)) - echo "release=$LATEST_RELEASE" >> $GITHUB_OUTPUT - - - name: Install dependencies - run: | - sudo apt install -y jq curl - - name: Get latest WordPress version id: get-wordpress-version run: | - LATEST_VERSION=$(curl -s https://api.wordpress.org/core/version-check/1.7/ | jq -r '.offers[0].current') - echo "Latest WordPress version is $LATEST_VERSION" - echo "version=$LATEST_VERSION" >> $GITHUB_OUTPUT + python -m pip install -r requirements.txt + python latest-version.py >> $GITHUB_OUTPUT + git push - name: Create release uses: softprops/action-gh-release@v2 - if: steps.get-latest-release.outputs.release != steps.get-wordpress-version.outputs.version + if: steps.get-wordpress-version.outputs.is_update == 'true' with: tag_name: ${{ steps.get-wordpress-version.outputs.version }} name: ${{ steps.get-wordpress-version.outputs.version }} diff --git a/latest-version.py b/latest-version.py index 24b8bf8..b83143f 100644 --- a/latest-version.py +++ b/latest-version.py @@ -71,16 +71,21 @@ def compare_current_version(latest_version): def git_commit(version): # Add changes to the staging area - subprocess.run(["git", "add", ".current-version"], check=True) + subprocess.run( + ["git", "add", ".current-version"], + check=True, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) # Commit the changes with the provided commit message subprocess.run( ["git", "commit", "-m", f"Update WordPress to version {version}"], check=True, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, ) - print("Commit successful!") - if __name__ == "__main__": version = get_latest_version() @@ -88,4 +93,4 @@ def git_commit(version): if is_update: git_commit(version) - print(is_update) + print(f"version={version}\nis_update={is_update}")