From 69084eb1c8c6a96e49ad71343e27614f14007757 Mon Sep 17 00:00:00 2001 From: ebner Date: Thu, 11 Jun 2026 17:03:36 +0200 Subject: [PATCH] add release check --- .gitea/workflows/check_releases.yaml | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.gitea/workflows/check_releases.yaml b/.gitea/workflows/check_releases.yaml index 15f2869..1b15bc9 100644 --- a/.gitea/workflows/check_releases.yaml +++ b/.gitea/workflows/check_releases.yaml @@ -5,8 +5,48 @@ on: jobs: check_releases: runs-on: "ubuntu-latest-intranet" + env: + TARGET_REPO_OWNER: "prefix-dev" + TARGET_REPO_NAME: "pixi" container: image: gitea.psi.ch/images/rhel9-developer-gitea-actions steps: - name: Check run: echo "Checking for new releases ..." + - name: Check for new releases in target repository + run: | + echo "--- Checking ${TARGET_REPO_OWNER}/${TARGET_REPO_NAME} for new releases ---" + + # 1. Fetch all releases and sort them by creation date descending + # We only need the latest release tag/date info + API_OUTPUT=$(curl -s \ + "https://api.github.com/repos/${{ env.TARGET_REPO_OWNER }}/${{ env.TARGET_REPO_NAME }}/releases?per_page=1") + + # Check if API call failed or returned no data + if [ "$API_OUTPUT" == '[]' ]; then + echo "⚠️ No releases found in the target repository." + exit 0 # Exit successfully, but do nothing. + fi + + # Extract the tag name and published date of the latest release + LATEST_TAG=$(echo "${API_OUTPUT}" | jq -r '.[0].tag_name') + PUBLISH_DATE=$(echo "${API_OUTPUT}" | jq -r '.[0].published_at') + + echo "✅ Found latest version: ${LATEST_TAG} published on ${PUBLISH_DATE}" + + # --- 2. Implement your custom logic here --- + # You need a mechanism to store the previously checked tag/date + # For simplicity, we will just check if we found ANY release data. + + # Example Logic: If you want to perform an action ONLY IF the date is new... + # (In a real scenario, you would compare $PUBLISH_DATE against a stored variable) + + echo "Successfully retrieved version data." + # echo "LATEST_VERSION=${LATEST_TAG}" >> $GITHUB_ENV + echo "LATEST_VERSION=${LATEST_TAG}" + + # - name: Deploy/Build action if release found + # if: env.LATEST_VERSION # This step runs ONLY if the previous step successfully set LATEST_VERSION + # run: | + # echo "🚀 A new major version ($LATEST_VERSION) has been released! Initiating build/deploy..." + # # Add your deployment steps here (e.g., upload artifact, trigger CI job)