Skip to content

Commit 12c0ddb

Browse files
authored
Rename beta-build.yml to send-beta-build.yml
1 parent 415dbad commit 12c0ddb

2 files changed

Lines changed: 88 additions & 63 deletions

File tree

.github/workflows/beta-build.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Deploy to Beta
2+
3+
on:
4+
push:
5+
branches:
6+
- updates
7+
workflow_dispatch:
8+
inputs:
9+
subfolder:
10+
description: 'Target subfolder in beta repo'
11+
required: true
12+
default: 'HTMLPlayerBeta'
13+
14+
concurrency:
15+
group: "deploy-beta"
16+
cancel-in-progress: false
17+
18+
permissions:
19+
contents: read # For artifact access
20+
21+
jobs:
22+
build-and-dispatch:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
artifact-url: ${{ steps.get-artifact.outputs.url }}
26+
steps:
27+
- name: Checkout source repo
28+
uses: actions/checkout@v4
29+
with:
30+
ref: updates
31+
32+
- name: Use Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: "20"
36+
37+
- name: Install dependencies
38+
working-directory: Build
39+
run: npm i
40+
41+
- name: Build
42+
working-directory: Build
43+
run: npm run build
44+
45+
- name: Zip build artifacts
46+
run: |
47+
cd Build/dist
48+
zip -r ../../../htmlplayer-build.zip .
49+
50+
- name: Upload artifact
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: htmlplayer-build
54+
path: htmlplayer-build.zip
55+
retention-days: 1 # Short retention since it's for deploy
56+
57+
- name: Get artifact download URL
58+
id: get-artifact
59+
uses: actions/github-script@v7
60+
with:
61+
script: |
62+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
63+
owner: context.repo.owner,
64+
repo: context.repo.repo,
65+
run_id: context.runId
66+
});
67+
const artifact = artifacts.data.artifacts.find(a => a.name === 'htmlplayer-build');
68+
if (!artifact) throw new Error('Artifact not found');
69+
core.setOutput('url', artifact.archive_download_url);
70+
71+
- name: Dispatch to beta repo
72+
run: |
73+
SUBFOLDER="${{ github.event.inputs.subfolder }}"
74+
ARTIFACT_URL="${{ steps.get-artifact.outputs.url }}"
75+
TOKEN="${{ secrets.GITHUB_TOKEN }}"
76+
curl -X POST \
77+
-H "Authorization: token ${TOKEN}" \
78+
-H "Accept: application/vnd.github.v3+json" \
79+
https://api.github.com/repos/HTMLToolkit/beta/dispatches \
80+
-d '{
81+
"event_type": "deploy-build",
82+
"client_payload": {
83+
"source_repo": "'${{ github.repository }}'",
84+
"artifact_url": "'${ARTIFACT_URL}'",
85+
"token": "'${TOKEN}'",
86+
"subfolder": "'${SUBFOLDER}'"
87+
}
88+
}'

0 commit comments

Comments
 (0)