Skip to content

Check all releases (latest patch of each minor version for the last 3 majors) #4

Check all releases (latest patch of each minor version for the last 3 majors)

Check all releases (latest patch of each minor version for the last 3 majors) #4

name: Check all releases (latest patch of each minor version for the last 3 majors)
on:
workflow_dispatch:
performAudit:
type: boolean
default: true
description: Run Audit
performITTests:
type: boolean
default: false
description: Run IT Tests
schedule:
- cron: "0 0 * * 6"
permissions:
contents: read
issues: write
jobs:
findTags:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.getTags.outputs.TAGS }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
fetch-tags: true
- name: Get the latest patch of each minor version for the last 3 majors
run: |
# Extract all releases
RELEASE_TAG_PATTERN="^v[0-9]+\.[0-9]+\.[0-9]+$"
ALL_RELEASES=$(git tag -l | sort -V | grep -E $RELEASE_TAG_PATTERN)
SUPPORTED_MAJORS=$(echo $ALL_RELEASES | tr ' ' '\n' | awk -F. '{print $1}' | uniq | tail -n 3)
ALL_SUPPORTED_RELEASES=$(echo $ALL_RELEASES | tr ' ' '\n' | grep -E "^($(echo $SUPPORTED_MAJORS | tr ' ' '|'))\.")
echo "Supported releases: $ALL_SUPPORTED_RELEASES"
# Take the latest minor for each previous major version
LATEST_MINOR_OF_EACH_MAJOR=$(echo $ALL_SUPPORTED_RELEASES | tr ' ' '\n' | awk -F. '{print $1}' | uniq | xargs -I {} sh -c "echo '$ALL_SUPPORTED_RELEASES' | grep -E '^{}.*' | tail -n 1" | head -n -1)
echo "Found latest minor of each major versions: $LATEST_MINOR_OF_EACH_MAJOR"
# Take the latest patch for each minor version of the current major
ALL_LATEST_MAJOR_RELEASES=$(echo $ALL_SUPPORTED_RELEASES | tr ' ' '\n' | awk -F. '{print $1}' | uniq | tail -n 1 | xargs -I {} sh -c "echo '$ALL_SUPPORTED_RELEASES' | grep -E '^{}.*'")
LATEST_PATCH_OF_EACH_MINOR=$(echo $ALL_LATEST_MAJOR_RELEASES | tr ' ' '\n' | awk -F. '{print $1 "." $2}' | uniq | xargs -I {} sh -c "echo '$ALL_LATEST_MAJOR_RELEASES' | grep -E '^{}.*' | tail -n 1")
echo "Found latest patch of each minor versions: $LATEST_PATCH_OF_EACH_MINOR"
# Export output in JSON format
TAGS=$(echo $LATEST_MINOR_OF_EACH_MAJOR $LATEST_PATCH_OF_EACH_MINOR | tr ' ' '\n' | awk '{print "\"" $0 "\""}' | tr '\n' ',')
echo "TAGS=[$TAGS]" >> "$GITHUB_OUTPUT"
id: getTags
checkRelease:
needs: findTags
strategy:
fail-fast: false
matrix:
tag: ${{ fromJSON(needs.findTags.outputs.tags) }}
uses: ./.github/workflows/check-release.yml
with:
ref: ${{ matrix.tag }}
performAudit: ${{ inputs.performAudit || true }}
performITTests: ${{ inputs.performITTests || false }}
report:
runs-on: ubuntu-latest
needs: checkRelease
if: failure()
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Create an issue
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUN_URL: ${{ format('https://github.com/{0}/actions/runs/{1}/attempts/{2}', github.repository, github.run_id, github.run_attempt || 1) }}
with:
filename: .github/check-release-issue-template.md
update_existing: true