Skip to content

.github/workflows/weekly-patch-release.yml #5

.github/workflows/weekly-patch-release.yml

.github/workflows/weekly-patch-release.yml #5

name: Generate weekly patch release(s)
on:
# Run every Monday at 6AM PST / 7AM PDT
# Run before monthly, so we don't immediately patch a new minor version
schedule:
- cron: '0 14 * * MON'
jobs:
generate-version-matrix:
name: Generate-matrix
runs-on: ubuntu-latest
if: github.repository == 'aws/sagemaker-distribution'
outputs:
matrix: ${{ steps.gen-mat.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Generate patch version matrix
id: gen-mat
# Output looks like :matrix={"version":["0.0.2","0.1.2",..."1.4.1"]}
# For each minor, get highest patch version. Use each patch
# as base version. Use this patch as base version.
run: |
versions=("{\"version\":[")
for minor in build_artifacts/v*/*; do
minor_version="${minor##*/}"
highest_patch=$(ls $minor | sort -t. -k3,3n | tail -n1)
versions+="\"${highest_patch#v}\""
versions+=","
done
versions=${versions::-1}
versions+="]}"
echo "matrix=$versions" >> $GITHUB_OUTPUT
start-weekly-patch:
name: Start weekly patch release
needs: generate-version-matrix
permissions:
pull-requests: write
contents: write
id-token: write
strategy:
matrix: ${{ fromJson(needs.generate-version-matrix.outputs.matrix) }}
fail-fast: false
uses: aws/sagemaker-distribution/.github/workflows/build-image.yml@main
with:
release-type: "patch"
base-version: ${{ matrix.version }}