diff --git a/.github/workflows/trigger-package-and-publish.yml b/.github/workflows/trigger-package-and-publish.yml new file mode 100644 index 000000000000..91a66f408a92 --- /dev/null +++ b/.github/workflows/trigger-package-and-publish.yml @@ -0,0 +1,93 @@ +name: Trigger Package and Publish + +on: + push: + branches: + - "att/**" + workflow_dispatch: + inputs: + trigger-type: + description: "How to trigger the target workflow" + required: true + type: choice + options: + - api + - workflow-run + +jobs: + trigger: + runs-on: concordia-linux-cpu4-ram14gi + env: + target_owner: "${{ secrets.TARGET_OWNER }}" + target_name: "${{ secrets.TARGET_NAME }}" + target_workflow: "${{ secrets.TARGET_WORKFLOW }}" + event_type: "${{ secrets.TARGET_EVENT_TYPE }}" + + steps: + - name: Checkout Repository + uses: actions/checkout@v6 + + - name: Install DNF Config Manager + run: | + sudo dnf -y install 'dnf-command(config-manager)' + + - name: Install GitHub CLI + run: | + sudo dnf -y config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo + sudo dnf -y install gh + + - name: Install gettext (for envsubvst) + run: | + sudo dnf -y install gettext + + - name: Install YQ + run: | + sudo curl -L -o /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 + sudo chmod a+x /usr/local/bin/yq + + - name: Authenticate GitHub CLI Using Access Token + run: | + echo "${{ secrets.TARGET_REPOSITORY_ACCESS_TOKEN }}" | gh auth login --with-token + gh auth status + + # Triggering workflows via the API is meant to be used by external systems. + - name: Trigger Workflow in Target Repository (api) + if: "${{ github.event.inputs.trigger-type == 'api'}}" + run: | + event_data=$(cat <