53 lines
2.2 KiB
YAML
53 lines
2.2 KiB
YAML
on:
|
|
schedule:
|
|
- cron: "* * * * *"
|
|
workflow_dispatch:
|
|
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)
|