Skip to content

Commit f0ef9a6

Browse files
committed
Draft release
1 parent e052196 commit f0ef9a6

8 files changed

Lines changed: 133 additions & 3 deletions

File tree

.github/workflows/static.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ on:
88

99
# Allows you to run this workflow manually from the Actions tab
1010
workflow_dispatch:
11+
inputs:
12+
source_ref:
13+
description: "Branch or tag to deploy from (default: current ref / master)"
14+
required: false
15+
default: ""
1116

1217
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1318
permissions:
1419
contents: read
1520
pages: write
1621
id-token: write
1722

18-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2023
concurrency:
2124
group: "pages"
2225
cancel-in-progress: false
@@ -29,6 +32,15 @@ jobs:
2932
url: ${{ steps.deployment.outputs.page_url }}
3033
runs-on: ubuntu-latest
3134
steps:
35+
- name: Determine ref to checkout
36+
id: ref
37+
run: |
38+
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.source_ref }}" ]; then
39+
echo "ref=${{ github.event.inputs.source_ref }}" >> "$GITHUB_OUTPUT"
40+
else
41+
# default: use the ref that triggered the workflow (master on push)
42+
echo "ref=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
43+
fi
3244
- name: Checkout
3345
uses: actions/checkout@v4
3446
with:

dist/draft/favicon.png

6.17 KB
Loading

dist/draft/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="refresh" content="5; url=/" />
6+
<meta name="robots" content="noindex" />
7+
<title>Redirecting...</title>
8+
<link rel="canonical" href="/" />
9+
</head>
10+
<body>
11+
<p>There is no draft currently published. Redirecting to <a href="/">main documentation</a>...</p>
12+
<script>
13+
setTimeout(function () {
14+
window.location.replace('/');
15+
}, 5000);
16+
</script>
17+
</body>
18+
</html>

dist/draft/logo.svg

Lines changed: 19 additions & 0 deletions
Loading

dist/draft/slevomat.svg

Lines changed: 10 additions & 0 deletions
Loading

docs/index-dev-banner.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>API Reference | Termino.eu Hotel API</title>
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<link rel="icon" type="image/png" href="favicon.png">
7+
<link rel="preconnect" href="https://fonts.googleapis.com">
8+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9+
<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400,500,600,700&amp;subset=latin-ext&amp;display=swap" rel="stylesheet">
10+
11+
<!--
12+
ReDoc uses font options from the parent element
13+
So override default browser styles
14+
-->
15+
<style>
16+
body {
17+
margin: 0;
18+
padding: 0;
19+
}
20+
.dev-banner {
21+
background: #ffe8e8;
22+
padding: 10px;
23+
border-left: 4px solid #ff0000;
24+
font-family: 'IBM Plex Sans', sans-serif;
25+
position: sticky;
26+
top: 0;
27+
z-index: 9999;
28+
}
29+
</style>
30+
{{{redocHead}}}
31+
</head>
32+
<body>
33+
34+
<div class="dev-banner">
35+
<b>&#x26A0;&#xFE0F; DEVELOPMENT DRAFT</b><br/>
36+
This version of the documentation is draft of upcoming API changes. It is provided for review and feedback purposes only and should not be used for current integrations. <br><br> The stable version of the API documentation is available <a href="https://api.termino.eu">here</a>.
37+
</div>
38+
{{{redocHTML}}}
39+
</body>
40+
</html>

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"start": "redocly preview-docs --port 18088",
1010
"build": "redocly bundle -o dist/dist.yaml",
1111
"test": "redocly lint",
12-
"build-page": "redocly build-docs -o dist/index.html && cp docs/*.{png,svg} dist/"
12+
"build-page": "redocly build-docs -o dist/index.html && cp docs/*.png docs/*.svg dist/",
13+
"build-page-dev": "redocly build-docs -t docs/index-dev-banner.html -o dist/draft/index.html && cp docs/*.png docs/*.svg dist/draft/",
14+
"build-pages": "npm run build-page && node scripts/build-draft-redirect.js"
1315
}
1416
}

scripts/build-draft-redirect.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const distDraftDir = path.join(__dirname, '..', 'dist', 'draft');
5+
const indexPath = path.join(distDraftDir, 'index.html');
6+
7+
fs.mkdirSync(distDraftDir, { recursive: true });
8+
9+
const html = `<!DOCTYPE html>
10+
<html lang="en">
11+
<head>
12+
<meta charset="utf-8" />
13+
<meta http-equiv="refresh" content="5; url=/" />
14+
<meta name="robots" content="noindex" />
15+
<title>Redirecting...</title>
16+
<link rel="canonical" href="/" />
17+
</head>
18+
<body>
19+
<p>This draft link has moved. Redirecting to <a href="/">/</a> in 5 seconds...</p>
20+
<script>
21+
setTimeout(function () {
22+
window.location.replace('/');
23+
}, 5000);
24+
</script>
25+
</body>
26+
</html>
27+
`;
28+
29+
fs.writeFileSync(indexPath, html);

0 commit comments

Comments
 (0)