Skip to content

Commit 7dfd643

Browse files
committed
chore: upload static to S3
1 parent cb02ebb commit 7dfd643

File tree

4 files changed

+63
-21
lines changed

4 files changed

+63
-21
lines changed

.github/workflows/checks.yml

+48-6
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ jobs:
2828
- run: npm ci
2929
- run: npm test
3030

31-
build-storybook:
31+
deploy-static:
3232
runs-on: ubuntu-latest
33+
environment: CI
3334

3435
strategy:
3536
matrix:
@@ -45,9 +46,50 @@ jobs:
4546
cache: "npm"
4647
- run: npm ci
4748
- run: npm run build-storybook
48-
- name: Save storybook static
49-
uses: actions/upload-artifact@v4
49+
- run: npm run build
50+
env:
51+
DOCUSAURUS_URL: https://storage.yandexcloud.net
52+
DOCUSAURUS_BASE_URL: ${{ secrets.AWS_S3_BUCKET }}/testplane-docs/website-static/${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}/
53+
- name: Upload storybook static
54+
uses: jakejarvis/[email protected]
5055
with:
51-
name: storybook static
52-
path: |
53-
storybook-static
56+
args: --acl public-read --follow-symlinks
57+
env:
58+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
59+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
60+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
61+
AWS_S3_ENDPOINT: https://s3.yandexcloud.net/
62+
SOURCE_DIR: "storybook-static"
63+
DEST_DIR: "testplane-docs/storybook-static/${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}/"
64+
- name: Upload website static
65+
uses: jakejarvis/[email protected]
66+
with:
67+
args: --acl public-read --follow-symlinks
68+
env:
69+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
70+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
71+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
72+
AWS_S3_ENDPOINT: https://s3.yandexcloud.net/
73+
SOURCE_DIR: "build"
74+
DEST_DIR: "testplane-docs/website-static/${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}/"
75+
76+
- name: Comment PR with links to deployed static on success
77+
if: ${{ success() }}
78+
uses: thollander/actions-comment-pull-request@v2
79+
with:
80+
message: |
81+
### :white_check_mark: Successfully deployed static
82+
83+
- [Docs website](https://storage.yandexcloud.net/testplane-ci/testplane-docs/website-static/${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}/index.html)
84+
- [Storybook](https://storage.yandexcloud.net/testplane-ci/testplane-docs/storybook-static/${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}/index.html)
85+
comment_tag: deployment_status
86+
87+
- name: Comment PR that static wasn't deployed on failure
88+
if: ${{ failure() }}
89+
uses: thollander/actions-comment-pull-request@v2
90+
with:
91+
message: |
92+
### :x: Failed to deploy static
93+
94+
Please check the workflow logs for details.
95+
comment_tag: deployment_status

.storybook/main.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,24 @@ const config: StorybookConfig = {
4343
rules: [
4444
...(config.module?.rules as Record<string, any>[]),
4545
{
46-
test: /\.(sa|sc|c)ss$/, // Test for .sass, .scss and .css files
46+
test: /\.(sa|sc|c)ss$/,
4747
use: [
48-
// MiniCssExtractPlugin.loader, // Extract css into separate files
4948
"style-loader",
50-
"css-loader", // Translates CSS into CommonJS
49+
"css-loader",
5150
{
52-
loader: "postcss-loader", // Loader for webpack to process CSS with PostCSS
51+
loader: "postcss-loader",
5352
options: {
5453
postcssOptions: {
5554
ident: "postcss",
5655
plugins: [
5756
require("postcss-import"),
58-
require("tailwindcss"), // use tailwindcss
59-
require("autoprefixer"), // add vendor prefixes
57+
require("tailwindcss"),
58+
require("autoprefixer"),
6059
],
6160
},
6261
},
6362
},
64-
"sass-loader", // Compiles Sass to CSS
63+
"sass-loader",
6564
],
6665
},
6766
],

docusaurus.config.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const config: Config = {
99
favicon: "img/favicon.ico",
1010

1111
// Set the production url of your site here
12-
url: "https://testplane.example.com",
12+
url: process.env.DOCUSAURUS_URL ?? "https://testplane.example.com",
1313
// Set the /<baseUrl>/ pathname under which your site is served
1414
// For GitHub pages deployment, it is often '/<projectName>/'
15-
baseUrl: "/",
15+
baseUrl: process.env.DOCUSAURUS_BASE_URL ?? "/",
1616

1717
// GitHub pages deployment config.
1818
organizationName: "gemini-testing",
@@ -60,7 +60,7 @@ const config: Config = {
6060
position: "left",
6161
label: "Tutorial",
6262
},
63-
{ to: "/blog", label: "Blog", position: "left" },
63+
{ to: "#", label: "Blog", position: "left" },
6464
{
6565
href: "https://github.com/facebook/docusaurus",
6666
label: "GitHub",
@@ -76,15 +76,15 @@ const config: Config = {
7676
items: [
7777
{
7878
label: "Configuration",
79-
to: "/docs/config",
79+
to: "#",
8080
},
8181
{
8282
label: "Events",
83-
to: "/docs/events",
83+
to: "#",
8484
},
8585
{
8686
label: "API reference",
87-
to: "/docs/api",
87+
to: "#",
8888
},
8989
],
9090
},
@@ -110,11 +110,11 @@ const config: Config = {
110110
},
111111
{
112112
label: "Installation",
113-
href: "/docs/installation",
113+
href: "#",
114114
},
115115
{
116116
label: "First tests with testplane",
117-
href: "/docs/first-tests",
117+
href: "#",
118118
},
119119
],
120120
},

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
6+
"build": "docusaurus build",
67
"start": "docusaurus start",
78
"lint": "eslint --cache src && prettier --check .",
89
"reformat": "eslint --cache --fix src && prettier --write .",

0 commit comments

Comments
 (0)