Came across this and wasn’t aware of it (though it makes total sense in retrospect), so I figured I’d pass the tip along.
Background: What is a Matrix Strategy in GitHub Actions?
Sometimes you need an GitHub Action Job to run for multiple combinations of items. In my case, I was looking to run an action to publish a Docker container across a combination of Ruby, Node, and GitHub Pages versions.
Running an action in this way will create an instance of that job for every combination in the matrix entries:
jobs:
build_release:
name: "Build and Release"
strategy:
matrix:
RUBY_VERSION: [2.7.3]
NODE_MAJOR_VERSION: [16, 18]
GITHUB_PAGES_VERSION: [226]
runs-on: ubuntu-latest
env:
RUBY_VERSION: ${{ matrix.RUBY_VERSION }}
NODE_MAJOR_VERSION: ${{ matrix.NODE_MAJOR_VERSION }}
GITHUB_PAGES_VERSION: ${{ matrix.GITHUB_PAGES_VERSION }}
Top comments (0)