Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions .github/workflows/publish-learn-latest.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
name: Publish learn-latest

on: [push]
on:
workflow_run:
workflows: ["Sphinx Books Tests"]
branches: [main]
types: [completed]

jobs:
trigger:
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}

strategy:
matrix:
python-version: ['3.12']
node-version: [24.x]
# strategy:
# matrix:
# python-version: ['3.12']
# node-version: [24.x]

steps:
- name: Trigger publishing on learn-latest repo
env:
TOKEN: ${{ secrets.LEARN_LATEST_TOKEN }}
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
BOOKS_RUN_ID: ${{ github.event.workflow_run.id }}
SOURCE_REPO: ${{ github.repository }}
run: |
# Set the required variables
repo_owner="AdaCore"
repo_name="learn-latest-html-pages"
event_type="trigger-workflow"
service="publish-learn-latest"
version="${GITHUB_WORKFLOW_SHA}"

curl -L \
# Look up the successful Sphinx Content Tests run ID for the same commit
content_run_id=$(curl -L --fail-with-body \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/$SOURCE_REPO/actions/workflows/sphinx-content-tests.js.yml/runs?head_sha=$HEAD_SHA&status=success&per_page=1" \
| jq -r '.workflow_runs[0].id')

curl -L --fail-with-body \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.LEARN_LATEST_TOKEN }}" \
-H "Authorization: Bearer $TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"service\": \"$service\", \"version\": \"$version\", \"unit\": false, \"integration\": true}}"
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"service\": \"$service\", \"version\": \"$HEAD_SHA\", \"books_run_id\": \"$BOOKS_RUN_ID\", \"content_run_id\": \"$content_run_id\", \"source_repo\": \"$SOURCE_REPO\", \"unit\": false, \"integration\": true}}"
Loading