File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy Demo to GitHub Pages
2+ run-name : ${{ github.actor }} deploy demo on ${{ github.repository }}
3+
4+ on :
5+ push :
6+ branches :
7+ - main
8+ workflow_dispatch :
9+
10+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
11+ permissions :
12+ contents : read
13+ pages : write
14+ id-token : write
15+
16+ # Allow only one concurrent deployment
17+ concurrency :
18+ group : " pages"
19+ cancel-in-progress : false
20+
21+ jobs :
22+ deploy :
23+ environment :
24+ name : github-pages
25+ url : ${{ steps.deployment.outputs.page_url }}
26+ runs-on : ubuntu-latest
27+
28+ steps :
29+ - name : Checkout code
30+ uses : actions/checkout@v4
31+
32+ - name : Setup Node.js
33+ uses : actions/setup-node@v4
34+ with :
35+ node-version : ' 20'
36+
37+ - name : Install dependencies
38+ run : npm install
39+
40+ - name : Build package
41+ run : npm run build
42+
43+ - name : Prepare demo for GitHub Pages
44+ run : |
45+ mkdir -p gh-pages
46+ cp -r demo/* gh-pages/
47+ # Update paths in demo to use CDN (escape dots in patterns)
48+ sed -i 's|\.\./src/tac-editor\.js|https://unpkg.com/@softwarity/interactive-code|g' gh-pages/index.html
49+
50+ - name : Setup Pages
51+ uses : actions/configure-pages@v4
52+
53+ - name : Upload artifact
54+ uses : actions/upload-pages-artifact@v3
55+ with :
56+ path : ' ./gh-pages'
57+
58+ - name : Deploy to GitHub Pages
59+ id : deployment
60+ uses : actions/deploy-pages@v4
Original file line number Diff line number Diff line change 1+ name : Build & Test
2+ run-name : ${{ github.actor }} run build on ${{ github.repository }}
3+
4+ on :
5+ push :
6+ branches :
7+ - ' *'
8+ pull_request :
9+ branches :
10+ - main
11+
12+ jobs :
13+ build :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v4
19+
20+ - name : Setup Node.js
21+ uses : actions/setup-node@v4
22+ with :
23+ node-version : ' 20'
24+
25+ - name : Install dependencies
26+ run : npm install
27+
28+ - name : Install Playwright browsers
29+ run : npx playwright install chromium
30+
31+ - name : Run tests with coverage
32+ run : npm test
33+ env :
34+ CI : true
35+
36+ - name : Upload coverage to Codecov
37+ uses : codecov/codecov-action@v5
38+ with :
39+ files : coverage/lcov.info
40+ fail_ci_if_error : false
41+ token : ${{ secrets.CODECOV_TOKEN }}
42+
43+ - name : Build package
44+ run : npm run build
45+
46+ - name : Check build output
47+ run : |
48+ if [ ! -f "dist/interactive-code.js" ]; then
49+ echo "Build failed: dist/interactive-code.js not found"
50+ exit 1
51+ fi
52+ echo "Build successful!"
Original file line number Diff line number Diff line change 1+ name : Create Tag/Release
2+ run-name : ${{ github.actor }} run build on ${{ github.repository }}
3+
4+ on :
5+ workflow_dispatch :
6+
7+ jobs :
8+ create-release :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout code
13+ uses : actions/checkout@v4
14+ with :
15+ token : ${{ secrets.PAT_TOKEN }} # Necessary to trigger tag workflow
16+
17+ - name : Setup Node.js
18+ uses : actions/setup-node@v4
19+ with :
20+ node-version : ' 20'
21+
22+ - name : Configure Git
23+ run : |
24+ git config user.name "$GITHUB_ACTOR"
25+ git config user.email ""
26+
27+ - name : Bump version (patch)
28+ run : npm version patch
29+
30+ - name : Push changes and tags
31+ run : |
32+ git push --all
33+ git push --tags
Original file line number Diff line number Diff line change 1+ name : Publish softwarity/interactive-code to NPM
2+ run-name : ${{ github.actor }} run build on ${{ github.repository }}
3+
4+ on :
5+ push :
6+ tags :
7+ - ' *'
8+
9+ jobs :
10+ publish-npm-package :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Checkout code
15+ uses : actions/checkout@v4
16+
17+ - name : Setup Node.js
18+ uses : actions/setup-node@v4
19+ with :
20+ node-version : ' 20'
21+
22+ - name : Configure npm authentication
23+ run : echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
24+
25+ - name : Install dependencies
26+ run : npm install
27+
28+ - name : Build package
29+ run : npm run build
30+
31+ - name : Publish to npm
32+ run : npm publish --access public
You can’t perform that action at this time.
0 commit comments