Skip to content

Commit 624320b

Browse files
ryan-williamsclaude
andcommitted
ci: auto-trigger dist build on push to main, use dist branch name
Push to `main` now auto-triggers the build-dist workflow. The `main` branch pushes to `dist` (matching the `pds` convention) instead of `main-dist`; other branches still get `<branch>-dist`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 15e3db2 commit 624320b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/build-dist.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Build dist branch
22

33
on:
4+
push:
5+
branches: [main]
46
workflow_dispatch:
57
inputs:
68
source_ref:
@@ -42,7 +44,12 @@ jobs:
4244
SHORT_SHA: ${{ steps.info.outputs.short_sha }}
4345
SOURCE_VERSION: ${{ steps.info.outputs.version }}
4446
run: |
45-
DIST_BRANCH="${SOURCE_REF}-dist"
47+
# `main` pushes to `dist` (matching pds convention); other branches get namespaced
48+
if [ "$SOURCE_REF" = "main" ]; then
49+
DIST_BRANCH="dist"
50+
else
51+
DIST_BRANCH="${SOURCE_REF}-dist"
52+
fi
4653
DIST_VERSION="${SOURCE_VERSION}-dist.${SHORT_SHA}"
4754
4855
# Configure git
@@ -63,7 +70,8 @@ jobs:
6370
git rm -rf .
6471
fi
6572
66-
# Clean and restore dist files
73+
# Clean working tree and restore only dist files
74+
git clean -fdx
6775
rm -rf dist/
6876
cp -r /tmp/dist-build/dist/ ./
6977
cp /tmp/dist-build/package.json ./
@@ -73,8 +81,8 @@ jobs:
7381
jq --arg v "$DIST_VERSION" '.version = $v' package.json > package.json.tmp
7482
mv package.json.tmp package.json
7583
76-
# Commit
77-
git add -A
84+
# Commit only the intended files
85+
git add dist/ package.json package-lock.json
7886
git commit -m "plotly.js@${DIST_VERSION}
7987
8088
Built from ${SOURCE_SHA}"

0 commit comments

Comments
 (0)