-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (87 loc) · 2.81 KB
/
Copy pathdeploy.yml
File metadata and controls
104 lines (87 loc) · 2.81 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
name: Deploy Portal
on:
push:
branches: [main]
paths:
- 'src/**'
- 'public/**'
- 'package.json'
- 'vite.config.ts'
- 'tsconfig.json'
workflow_dispatch:
# Allow only one concurrent deployment
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build portal
run: npm run build
- name: Download frontend builds from GitHub releases
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
run: |
# Read channels.json to get versions for each channel
for channel in stable beta nightly; do
# Get version from channels.json
VERSION=$(jq -r --arg ch "$channel" '.[$ch] // empty' channels.json)
if [ -z "$VERSION" ] || [ "$VERSION" = "null" ]; then
echo "No version configured for ${channel}, skipping"
continue
fi
echo "Downloading ${channel} frontend v${VERSION}..."
# Create temp directory
mkdir -p "/tmp/${channel}"
# Download the wheel from GitHub releases
WHEEL_NAME="music_assistant_frontend-${VERSION}-py3-none-any.whl"
if gh release download "${VERSION}" \
--repo music-assistant/frontend \
--pattern "${WHEEL_NAME}" \
--dir "/tmp/${channel}" 2>/dev/null; then
# Extract the wheel
unzip -q "/tmp/${channel}/${WHEEL_NAME}" -d "/tmp/${channel}/extracted"
# Copy to channel subdirectory
mkdir -p "dist/${channel}"
cp -r "/tmp/${channel}/extracted/music_assistant_frontend/"* "dist/${channel}/"
# Create version.json
cat > "dist/${channel}/version.json" << EOF
{
"channel": "${channel}",
"frontend_version": "${VERSION}",
"deployed_at": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
}
EOF
echo "Restored ${channel} build (v${VERSION})"
else
echo "Failed to download ${channel} frontend v${VERSION}"
fi
done
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist/
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4