From 0bedb2972ba4d958e24a80a6cc980fe8d8288f80 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sat, 17 Aug 2024 22:38:21 -0400 Subject: [PATCH] CI: Dynamically determine versions to build I figured out this trick when working on SecureDrop (https://github.com/freedomofpress/securedrop/pull/7222), we can dynamically generate the values for the matrix so we don't have to update them. That's not really a big burden anyways, but this is kind of cool. --- .github/workflows/build.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d1f5d3..d59ffa8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,13 +3,29 @@ on: pull_request: push: +defaults: + run: + shell: bash + jobs: + lookup-versions: + runs-on: ubuntu-latest + + outputs: + versions: ${{ steps.versions.outputs.versions }} + steps: + - uses: actions/checkout@v4 + - name: Get current versions + id: versions + run: | + echo "versions=$(python -c 'import glob, json; print(json.dumps(glob.glob("1.*")))')" >> $GITHUB_OUTPUT + build: runs-on: ubuntu-latest strategy: matrix: - version: ['1.39', '1.41', '1.42'] + version: ${{ fromJson(needs.lookup-versions.outputs.versions) }} type: [apache, fpm, fpm-alpine] steps: