File tree Expand file tree Collapse file tree 2 files changed +30
-6
lines changed
Expand file tree Collapse file tree 2 files changed +30
-6
lines changed Original file line number Diff line number Diff line change 77 pull_request :
88 branches :
99 - main
10+ types :
11+ - opened
12+ - reopened
13+ - synchronize
14+ - closed
1015 workflow_dispatch :
1116
1217permissions :
1318 contents : write # to write the built page to the branch
1419
20+ env :
21+ PAGES_BASE : ${{ github.event_name == 'pull_request' && format('pr-preview/pr-{0}', github.event.pull_request.number) || '/' }}
22+
1523concurrency :
16- group : pages
24+ # set separate concurrency groups for main and PR branches
25+ group : ${{ github.event_name == 'pull_request' && format('pages-preview-{0}', github.event.pull_request.number) || 'pages-main' }}
1726 cancel-in-progress : false
1827
1928jobs :
2029
30+ delete-preview :
31+ if : github.event_name == 'pull_request' && github.event.action == 'closed'
32+ runs-on : ubuntu-latest
33+ steps :
34+ - uses : rossjrw/pr-preview-action@v1
35+ with :
36+ action : remove
37+
2138 build :
2239 runs-on : ubuntu-latest
40+ # only build on main or if the PR is open
41+ if : github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.event.action != 'closed')
2342 steps :
2443 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2544 with :
@@ -34,11 +53,18 @@ jobs:
3453 - run : npm ci
3554 - run : npm run build
3655
56+ # deploy the PR to a preview URL
3757 - uses : rossjrw/pr-preview-action@9f77b1d057b494e662c50b8ca40ecc63f21e0887 # v1
3858 if : ${{ github.event_name == 'pull_request' }}
3959 with :
4060 source-dir : .vitepress/dist
61+ - uses : thollander/actions-comment-pull-request@v3
62+ if : github.event_name == 'pull_request'
63+ with :
64+ message : |
65+ A preview has been deployed to ${{ format('{0}/{1}', steps.deployment.outputs.page_url, env.PAGES_BASE }}
4166
67+ # deploy the build to GitHub Pages
4268 - uses : JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4
4369 if : ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' }}
4470 with :
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { fileURLToPath, URL } from 'node:url'
55export default withMermaid ( {
66 title : "Platform Mesh" ,
77
8+ base : process . env . PAGES_BASE ? process . env . PAGES_BASE : '/' ,
89
910 description : "Platform Mesh - Building upon the Kubernetes API & Resource Model" ,
1011
@@ -41,7 +42,6 @@ export default withMermaid({
4142 width : 24 ,
4243 height : 24
4344 } ,
44-
4545
4646 outline : [ 2 , 3 , 4 , 5 ] ,
4747
@@ -63,7 +63,7 @@ export default withMermaid({
6363 ]
6464 }
6565 ] ,
66-
66+
6767 '/scenarios' : {
6868 test : 'Scenarios' ,
6969 items : [
@@ -72,13 +72,11 @@ export default withMermaid({
7272 ] ,
7373 } ,
7474
75-
7675 } ,
77-
7876
7977 socialLinks : [
8078 { icon : 'github' , link : 'https://github.com/platform-mesh' }
8179 ]
8280 } ,
83-
81+
8482} )
You can’t perform that action at this time.
0 commit comments