generated from LizardByte/template-base
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Labels
Description
Is there an existing issue for this item?
- I have searched the existing issues
Repositories
LizardByte/setup-release-action, LizardByte/create-release-action, LizardByte/update-changelog-action
Languages/Skills/Technologies
GitHub actions, Bash/Shell/Scripting
Description
It is somewhat difficult to maintain each action and all the releases they generate. This could be simplified by moving the release actions to a single repo.
Here is an example CI workflow that can work for a repo with multiple actions, although it might need more tweaks in order to work for these cases.
---
name: CI
on:
pull_request:
branches:
- master
types:
- opened
- synchronize
- reopened
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build matrix with action paths
id: set-matrix
run: |
entries=()
while IFS= read -r file; do
action_dir=$(dirname "$file")
jq --arg action "$action_dir" '.[] | . + {action: $action}' "$file"
done < <(find . -name 'ci-matrix.json') | jq -s '.' > merged-matrix.json
echo "matrix=$(cat merged-matrix.json | jq -c .)" >> $GITHUB_OUTPUT
test:
needs: generate-matrix
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Debug matrix
run: |
echo "Matrix: ${{ toJson(matrix) }}"
echo "Action: ${{ matrix.action }}"
echo "With: ${{ toJson(matrix.with) }}"
- name: Test action
uses: jenseng/dynamic-uses@f972650db6e7523890d27533271417f58681cf5b
with:
uses: ${{ matrix.action }}
with: '${{ matrix.with }}'
It requires a ci-matrix.json
file next to each action.yml
file, with a structure like the following.
[
{
"runs-on": "ubuntu-latest"
},
{
"runs-on": "ubuntu-latest",
"container": "ubuntu:24.04"
},
{
"runs-on": "ubuntu-latest",
"container": "ubuntu:24.04",
"with": {
"my_input": "my_value"
}
}
]
Estimated Effort
effort:Medium
Priority
priority:Low
Target Milestone
1-3 months
Dependencies
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done