Skip to content

Commit a801ca6

Browse files
PascalThuetclaude
andcommitted
ci: consolidate master deploys into a single workflow (4 builds → 1)
Replace the three separate master deploy workflows (deploy_latest, deploy_build_latest, deploy_build_latest_as_version_folder) with a single deploy_master workflow that: 1. Builds once (npm run build + samples + jsdoc) 2. Uploads all artifacts 3. Fans out 4 parallel deploy jobs (samples latest, build latest, samples versioned, build versioned) The reusable deploy.yml is left intact for nightly and v4 workflows. Refs Dash-Industry-Forum#5004 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d4afee5 commit a801ca6

4 files changed

Lines changed: 174 additions & 84 deletions

File tree

.github/workflows/deploy_build_latest.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/deploy_build_latest_as_version_folder.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/deploy_latest.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: deploy_master
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
8+
jobs:
9+
build:
10+
if: github.repository == 'Dash-Industry-Forum/dash.js'
11+
runs-on: ubuntu-latest
12+
outputs:
13+
version: ${{ steps.set_version.outputs.version }}
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Setup dash.js
17+
uses: ./.github/actions/setup-dashjs
18+
- name: Run build
19+
run: npm run build
20+
- name: Read version from package.json
21+
id: set_version
22+
run: echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
23+
shell: bash
24+
- name: Find and Replace commit info
25+
uses: jacobtomlinson/gha-find-replace@v2
26+
env:
27+
replacement_string: ${{ format('{0} - commit <a href="https://github.com/Dash-Industry-Forum/dash.js/commit/{1}">{2}</a>', github.ref_name, github.sha, github.sha)}}
28+
with:
29+
find: "<!-- commit-info -->"
30+
replace: ${{env.replacement_string}}
31+
include: "samples/dash-if-reference-player*/index.html"
32+
- name: Build all samples
33+
run: |
34+
for sample in "network-interceptor"; do
35+
echo "Building sample: $sample"
36+
cd samples/$sample
37+
npm install
38+
npm run build
39+
rm -rf node_modules
40+
done
41+
- name: Build JSDoc
42+
run: npm run doc
43+
continue-on-error: true
44+
- name: Upload build artifacts
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: build-output
48+
path: |
49+
contrib/
50+
dist/
51+
samples/
52+
docs/jsdoc/
53+
index.d.ts
54+
retention-days: 1
55+
56+
deploy_samples_latest:
57+
needs: build
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Download build artifacts
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: build-output
64+
path: artifacts/
65+
- name: Prepare deploy directory
66+
run: |
67+
mkdir -p latest
68+
cp -R artifacts/contrib artifacts/dist artifacts/samples latest
69+
- name: Install SSH Key
70+
uses: shimataro/ssh-key-action@v2
71+
with:
72+
key: ${{ secrets.PRIVATE_KEY }}
73+
known_hosts: unnecessary
74+
- name: Fetch host keys
75+
run: ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts
76+
- name: Deploy with scp
77+
env:
78+
DEPLOY_USER: ${{ secrets.USER }}
79+
DEPLOY_HOST: ${{ secrets.HOST }}
80+
run: |
81+
ssh "$DEPLOY_USER@$DEPLOY_HOST" "mkdir -p /377335/dash.js/latest"
82+
scp -r latest "$DEPLOY_USER@$DEPLOY_HOST:/377335/dash.js"
83+
84+
deploy_build_latest:
85+
needs: build
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Download build artifacts
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: build-output
92+
path: artifacts/
93+
- name: Prepare deploy directory
94+
run: |
95+
mkdir -p latest
96+
cp -R artifacts/docs/jsdoc latest/jsdoc
97+
cp -R artifacts/dist/modern/umd/* latest
98+
cp -R artifacts/dist/* artifacts/index.d.ts latest
99+
- name: Install SSH Key
100+
uses: shimataro/ssh-key-action@v2
101+
with:
102+
key: ${{ secrets.PRIVATE_KEY }}
103+
known_hosts: unnecessary
104+
- name: Fetch host keys
105+
run: ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts
106+
- name: Deploy with scp
107+
env:
108+
DEPLOY_USER: ${{ secrets.USER }}
109+
DEPLOY_HOST: ${{ secrets.HOST }}
110+
run: |
111+
ssh "$DEPLOY_USER@$DEPLOY_HOST" "mkdir -p /377335/latest"
112+
scp -r latest "$DEPLOY_USER@$DEPLOY_HOST:/377335"
113+
114+
deploy_samples_versioned:
115+
needs: build
116+
runs-on: ubuntu-latest
117+
env:
118+
ENVNAME: v${{ needs.build.outputs.version }}
119+
steps:
120+
- name: Download build artifacts
121+
uses: actions/download-artifact@v4
122+
with:
123+
name: build-output
124+
path: artifacts/
125+
- name: Prepare deploy directory
126+
run: |
127+
mkdir -p "$ENVNAME"
128+
cp -R artifacts/contrib artifacts/dist artifacts/samples "$ENVNAME"
129+
- name: Install SSH Key
130+
uses: shimataro/ssh-key-action@v2
131+
with:
132+
key: ${{ secrets.PRIVATE_KEY }}
133+
known_hosts: unnecessary
134+
- name: Fetch host keys
135+
run: ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts
136+
- name: Deploy with scp
137+
env:
138+
DEPLOY_USER: ${{ secrets.USER }}
139+
DEPLOY_HOST: ${{ secrets.HOST }}
140+
run: |
141+
ssh "$DEPLOY_USER@$DEPLOY_HOST" "mkdir -p \"/377335/dash.js/$ENVNAME\""
142+
scp -r "$ENVNAME" "$DEPLOY_USER@$DEPLOY_HOST:/377335/dash.js"
143+
144+
deploy_build_versioned:
145+
needs: build
146+
runs-on: ubuntu-latest
147+
env:
148+
ENVNAME: v${{ needs.build.outputs.version }}
149+
steps:
150+
- name: Download build artifacts
151+
uses: actions/download-artifact@v4
152+
with:
153+
name: build-output
154+
path: artifacts/
155+
- name: Prepare deploy directory
156+
run: |
157+
mkdir -p "$ENVNAME"
158+
cp -R artifacts/docs/jsdoc "$ENVNAME/jsdoc"
159+
cp -R artifacts/dist/modern/umd/* "$ENVNAME"
160+
cp -R artifacts/dist/* artifacts/index.d.ts "$ENVNAME"
161+
- name: Install SSH Key
162+
uses: shimataro/ssh-key-action@v2
163+
with:
164+
key: ${{ secrets.PRIVATE_KEY }}
165+
known_hosts: unnecessary
166+
- name: Fetch host keys
167+
run: ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts
168+
- name: Deploy with scp
169+
env:
170+
DEPLOY_USER: ${{ secrets.USER }}
171+
DEPLOY_HOST: ${{ secrets.HOST }}
172+
run: |
173+
ssh "$DEPLOY_USER@$DEPLOY_HOST" "mkdir -p \"/377335/$ENVNAME\""
174+
scp -r "$ENVNAME" "$DEPLOY_USER@$DEPLOY_HOST:/377335"

0 commit comments

Comments
 (0)