-
Notifications
You must be signed in to change notification settings - Fork 6
149 lines (130 loc) · 4.88 KB
/
Copy pathnightly.yml
File metadata and controls
149 lines (130 loc) · 4.88 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Nightly
on:
schedule:
- cron: '17 3 * * *'
workflow_dispatch:
concurrency:
group: nightly
cancel-in-progress: false
permissions:
contents: read
id-token: write
jobs:
publish:
name: Publish dev snapshot
if: github.repository_owner == 'PyModel'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pinned from v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # pinned from v6
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # pinned from v7.0.0
with:
node-version-file: .nvmrc
cache: "pnpm"
registry-url: "https://registry.npmjs.org"
- name: Upgrade npm for Trusted Publishing
run: npm install -g npm@latest
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate Pythinker Code built-in catalog
shell: bash
run: |
CATALOG_FILE="$RUNNER_TEMP/pythinker-code-built-in-catalog.json"
node apps/pythinker-code/scripts/update-catalog.mjs --out "$CATALOG_FILE"
echo "PYTHINKER_CODE_BUILT_IN_CATALOG_FILE=$CATALOG_FILE" >> "$GITHUB_ENV"
- name: Build packages
run: pnpm build
- name: Publish dev snapshot
run: |
pnpm changeset version --snapshot dev
VERSION=$(node -p "require('./apps/pythinker-code/package.json').version")
if npm view "@pymodel/pythinker-code@$VERSION" version >/dev/null 2>&1; then
echo "already published — no new commits"
exit 0
fi
pnpm changeset publish --tag dev --no-git-tag
desktop-nightly:
name: Publish desktop Nightly
if: github.repository_owner == 'PyModel'
uses: ./.github/workflows/desktop-release.yml
with:
publish_nightly: true
secrets: inherit
release-reconciliation:
name: Reconcile release lanes
needs: [publish, desktop-nightly]
if: always() && github.repository_owner == 'PyModel'
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pinned from v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # pinned from v7.0.0
with:
node-version-file: .nvmrc
- name: Check release lane status
id: release-status
env:
GITHUB_TOKEN: ${{ github.token }}
UPSTREAM_OK: ${{ needs.publish.result == 'success' && needs.desktop-nightly.result == 'success' }}
shell: bash
run: |
set +e
node scripts/release/release-status.mjs > "$RUNNER_TEMP/release-status.md" 2>&1
status=$?
if [ "$UPSTREAM_OK" != 'true' ]; then
printf '\nNightly publishers did not both succeed. CLI: %s. Desktop: %s.\n' \
'${{ needs.publish.result }}' '${{ needs.desktop-nightly.result }}' >> "$RUNNER_TEMP/release-status.md"
status=1
fi
set -e
cat "$RUNNER_TEMP/release-status.md" >> "$GITHUB_STEP_SUMMARY"
echo "exit_code=$status" >> "$GITHUB_OUTPUT"
- name: Sync release drift issue
env:
GH_TOKEN: ${{ github.token }}
RELEASE_STATUS: ${{ steps.release-status.outputs.exit_code }}
shell: bash
run: |
set -euo pipefail
title='Release lane drift detected'
mapfile -t issues < <(gh issue list \
--state open \
--limit 100 \
--json number,title \
--jq '.[] | select(.title == "Release lane drift detected") | .number')
if [ "$RELEASE_STATUS" = '0' ]; then
for issue in "${issues[@]}"; do
gh issue close "$issue" --comment 'Automated release reconciliation is clean.'
done
exit 0
fi
body="$RUNNER_TEMP/release-drift-issue.md"
{
echo 'The nightly release reconciliation found drift or could not query a release surface.'
echo
echo "Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
echo
cat "$RUNNER_TEMP/release-status.md"
} > "$body"
if [ "${#issues[@]}" -eq 0 ]; then
gh issue create --title "$title" --body-file "$body"
else
gh issue edit "${issues[0]}" --title "$title" --body-file "$body"
for issue in "${issues[@]:1}"; do
gh issue close "$issue" --comment "Duplicate of #${issues[0]}."
done
fi
exit "$RELEASE_STATUS"