-
-
Notifications
You must be signed in to change notification settings - Fork 299
97 lines (86 loc) · 2.87 KB
/
Copy pathpublish-manifests.yml
File metadata and controls
97 lines (86 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Publish Manifests
permissions:
contents: read
on:
release:
types: [published]
workflow_dispatch:
inputs:
ref:
description: "Override ref/tag to publish (defaults to release tag)"
required: false
type: string
jobs:
publish:
runs-on: ubuntu-latest
env:
WEBSITE_REPO: getsentry/xcodebuildmcp.com
WEBSITE_BRANCH: main
TARGET_FILE: app/docs/_data/generated/manifests.json
steps:
- name: Checkout source repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.event.release.tag_name || github.ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install dependencies
run: npm install --ignore-scripts
- name: Fail if deploy key is missing
env:
DEPLOY_KEY: ${{ secrets.XCODEBUILDMCP_WEBSITE_DEPLOY_KEY }}
run: |
set -euo pipefail
if [ -z "$DEPLOY_KEY" ]; then
echo "XCODEBUILDMCP_WEBSITE_DEPLOY_KEY is required to publish manifests." >&2
exit 1
fi
- name: Configure SSH for website repository
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.XCODEBUILDMCP_WEBSITE_DEPLOY_KEY }}
- name: Clone website repository
run: |
set -euo pipefail
git clone "git@github.com:${WEBSITE_REPO}.git" website-repo
cd website-repo
git checkout "$WEBSITE_BRANCH"
git pull --ff-only origin "$WEBSITE_BRANCH"
- name: Resolve ref
id: ref
env:
INPUT_REF: ${{ inputs.ref }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
set -euo pipefail
REF="${INPUT_REF:-$RELEASE_TAG}"
if [ -z "$REF" ]; then
echo "No ref available (workflow_dispatch without input on a non-release event)." >&2
exit 1
fi
echo "value=$REF" >> "$GITHUB_OUTPUT"
- name: Generate manifests.json into website repo
env:
REF: ${{ steps.ref.outputs.value }}
run: |
set -euo pipefail
node scripts/build-website-manifest.mjs \
--out="website-repo/${TARGET_FILE}" \
--ref="$REF"
- name: Commit and push website update
env:
REF: ${{ steps.ref.outputs.value }}
run: |
set -euo pipefail
cd website-repo
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add "$TARGET_FILE"
if git diff --cached --quiet; then
echo "Manifest publish target already up to date."
exit 0
fi
git commit -m "Publish manifests from ${GITHUB_REPOSITORY}@${REF}"
git push origin "$WEBSITE_BRANCH"