-
-
Notifications
You must be signed in to change notification settings - Fork 18
86 lines (69 loc) · 2.3 KB
/
deploy-playground.yml
File metadata and controls
86 lines (69 loc) · 2.3 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
name: Deploy Playground to GitHub Pages
on:
release:
types: [published, created]
# Allow manual trigger for testing
workflow_dispatch:
# Sets permissions for GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'npm'
- name: Install dependencies
run: npm ci --prefer-offline --no-audit --no-update-notifier
- name: Run linting
run: npm run lint
- name: Run tests
run: npm run test
- name: Build library
run: npm run build
- name: Build documentation
run: npm run build:docs
- name: Update playground version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "Updating playground to version $VERSION"
find playground -type f \( -name '*.js' -o -name '*.html' \) -exec sed -i.bak "s/css-selector-parser@[0-9.]*[0-9]/css-selector-parser@$VERSION/g" {} \;
find playground -type f -name '*.bak' -delete
- name: Prepare deployment directory
run: |
mkdir -p deploy
# Copy playground files
cp -r playground/* deploy/
# Copy documentation
cp -r docs deploy/docs
# Ensure .nojekyll exists to prevent Jekyll processing
touch deploy/.nojekyll
echo "Deployment directory contents:"
ls -la deploy/
- name: Setup GitHub Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'deploy'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Output deployment URL
run: |
echo "✅ Playground deployed successfully!"
echo "🎮 Playground URL: https://mdevils.github.io/css-selector-parser/"
echo "📚 Documentation: https://mdevils.github.io/css-selector-parser/docs/"