Skip to content

Commit

Permalink
CI: Dynamically determine versions to build
Browse files Browse the repository at this point in the history
I figured out this trick when working on SecureDrop (freedomofpress/securedrop#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.
  • Loading branch information
legoktm committed Aug 18, 2024
1 parent fb80440 commit 0bedb29
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0bedb29

Please sign in to comment.