another attempt to trigger #100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image Publish Matrix (All) | |
on: | |
workflow_dispatch: | |
workflow_call: | |
push: | |
branches: | |
- master | |
- develop | |
tags: | |
- tc_nightly* | |
- tc_v*.*.* | |
pull_request: | |
branches: [ "master", "develop" ] | |
jobs: | |
generate-workflows-list: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix_json: ${{ steps.discover_workflows.outputs.matrix_json }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Discover Workflows | |
id: discover_workflows | |
run: | | |
# Find all YAML files in the .github/workflows directory that start with "publish_docker_matrix_" | |
workflows=$(find .github/workflows -name 'publish_docker_matrix_*.yml' -exec basename {} \;) | |
echo "Found workflows: $workflows" | |
# Convert to JSON array | |
matrix_json=$(echo "$workflows" | tr ' ' '\n' | sed 's/^/"/;s/$/"/' | paste -sd, - | sed 's/^/[ /;s/$/ ]/') | |
echo "matrix_json=$matrix_json" >> $GITHUB_ENV | |
trigger-workflows: | |
needs: generate-workflows-list | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
workflow: ${{ fromJson(needs.generate-workflows-list.outputs.matrix_json) }} | |
steps: | |
- name: Trigger Workflows | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REPO: ${{ github.repository }} | |
BRANCH: ${{ github.ref_name }} | |
run: | | |
workflow_file="${{ matrix.workflow }}" | |
echo "Triggering workflow $workflow_file" | |
curl -X POST \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/$REPO/actions/workflows/$workflow_file/dispatches \ | |
-d "{\"ref\":\"$BRANCH\"}" | |
- name: Trigger Workflow Debian | |
uses: ./.github/workflows/publish_docker_matrix_debian.yml | |
with: | |
branch: ${{ github.ref_name }} # Passing the current branch name | |
secrets: inherit # Inherit secrets from the calling workflow | |
- name: Trigger Workflow Ubuntu | |
uses: ./.github/workflows/publish_docker_matrix_ubuntu.yml | |
with: | |
branch: ${{ github.ref_name }} # Passing the current branch name | |
secrets: inherit # Inherit secrets from the calling workflow | |
- name: Trigger Workflow Alpine | |
uses: ./.github/workflows/publish_docker_matrix_alpine.yml | |
with: | |
branch: ${{ github.ref_name }} # Passing the current branch name | |
secrets: inherit # Inherit secrets from the calling workflow | |
# trigger-workflows: | |
# runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# workflow: ${{ fromJson(needs.generate-workflows-list.outputs.matrix_json) }} | |
# steps: | |
# - name: Trigger Workflow ${{ matrix.workflow }} | |
# uses: ./.github/workflows/${{ matrix.workflow }} | |
# with: | |
# branch: ${{ github.ref_name }} # Passing the current branch name | |
# secrets: inherit # Inherit secrets from the calling workflow |