@@ -155,6 +155,68 @@ jobs:
155155 --data-urlencode "topic=software releases" \
156156 --data-urlencode "content=${CONTENT}"
157157
158+ - name : checkout
159+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
160+
161+ - name : Build dispatch payload
162+ id : payload
163+ shell : bash
164+ env :
165+ NAME : ${{ github.event.repository.name }}
166+ REPO_URL : ${{ github.server_url }}/${{ github.repository }}
167+ VERSION : ${{ github.event.inputs.version }}
168+ META_FILE : .github/web-meta.yaml
169+ CFF_FILE : CITATION.cff
170+ run : |
171+ for f in "$META_FILE" "$CFF_FILE"; do
172+ if [ ! -f "$f" ]; then
173+ echo "::error::$f not found in $(pwd)"
174+ ls -la . .github
175+ exit 1
176+ fi
177+ done
178+
179+ # Constructed URLs (Read the Docs slugs are lowercase)
180+ github_url="$REPO_URL"
181+ docs_url="https://${NAME,,}.readthedocs.io/"
182+
183+ # Metadata from web-meta.yaml
184+ meta=$(yq -o=json '.' "$META_FILE")
185+
186+ # Authors from CITATION.cff -> { "Full Name": "orcid url" }
187+ authors=$(yq -o=json '.authors' "$CFF_FILE" | jq -c '
188+ map({
189+ key: (
190+ if .name then .name
191+ else ([."given-names", ."family-names"] | map(select(. != null)) | join(" "))
192+ end
193+ ),
194+ value: (.orcid // "")
195+ }) | from_entries')
196+
197+ payload=$(jq -nc \
198+ --arg name "$NAME" \
199+ --arg github "$github_url" \
200+ --arg docs "$docs_url" \
201+ --arg version "$VERSION" \
202+ --argjson meta "$meta" \
203+ --argjson authors "$authors" \
204+ '{
205+ name: $name,
206+ meta: ({github: $github, docs: $docs} + $meta + {version: $version, authors: $authors})
207+ }')
208+
209+ echo "payload: $payload"
210+ echo "json=$payload" >> "$GITHUB_OUTPUT"
211+
212+ - name : Post version to website metadata repo
213+ uses : peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
214+ with :
215+ token : ${{ secrets.BUILD_TOKEN }}
216+ repository : ccpbiosim/ccpbiosim.github.io
217+ event-type : workshops
218+ client-payload : ${{ steps.payload.outputs.json }}
219+
158220 pypi :
159221 name : make pypi release
160222 needs : [tag, release]
0 commit comments