Skip to content

Commit 7385644

Browse files
committed
chore: add Playroom deployment
1 parent a48bd0d commit 7385644

File tree

4 files changed

+97
-0
lines changed

4 files changed

+97
-0
lines changed

.github/workflows/delete-tests-reports.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ jobs:
1818
uses: ./.github/actions/node
1919

2020
- name: Delete Report
21+
# yarn surge teardown $DOMAIN_PLAYROOM --token ${{ secrets.SURGE_TOKEN }}
2122
run: |
2223
echo "Deleting report for branch $BRANCH_NAME"
2324
BRANCH_URL=$(echo ${BRANCH_NAME} | sed -e 's/[^a-zA-Z0-9]/-/g')
2425
DOMAIN=https://kiwicom-orbit-test-report-${BRANCH_URL}.surge.sh
26+
DOMAIN_PLAYROOM=https://kiwicom-orbit-test-report-${BRANCH_URL}-playroom.surge.sh
2527
yarn surge teardown $DOMAIN --token ${{ secrets.SURGE_TOKEN }}
2628
continue-on-error: true

.github/workflows/playroom.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Playroom
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- "**"
10+
11+
env: # Set environment variables for every job and step in this workflow
12+
CLICOLOR: "1" # Enable colors for *NIX commands
13+
PY_COLORS: "1" # Enable colors for Python-based utilities
14+
FORCE_COLOR: "1" # Force colors in the terminal
15+
16+
jobs:
17+
deploy:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
pull-requests: write # for dependabot
21+
contents: write # for deploying to GitHub Pages on master
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Node
27+
uses: ./.github/actions/node
28+
29+
- name: Compile design tokens
30+
run: yarn tokens build
31+
32+
- name: Build tailwind
33+
run: yarn tailwind-preset build
34+
35+
- name: Build components
36+
run: yarn components build
37+
38+
- name: Build Playroom
39+
run: yarn components build:playroom
40+
41+
- name: Get BRANCH_URL
42+
# do not run on master branch
43+
if: github.ref != 'refs/heads/master'
44+
env:
45+
BRANCH_NAME: ${{ github.head_ref }}
46+
run: echo "BRANCH_URL=$(sed -e 's/[^a-zA-Z0-9]/-/g' <<< ${BRANCH_NAME})" >> $GITHUB_ENV
47+
48+
- name: Get DOMAIN
49+
if: github.ref != 'refs/heads/master'
50+
run: echo "DOMAIN=https://kiwicom-orbit-playroom-${BRANCH_URL}.surge.sh" >> $GITHUB_ENV
51+
52+
- name: Deploy to staging
53+
if: github.ref != 'refs/heads/master'
54+
run: yarn components deploy:surge ${DOMAIN} --token ${{ secrets.SURGE_TOKEN }}
55+
56+
- name: Add comment to PR
57+
if: github.ref != 'refs/heads/master'
58+
uses: actions/github-script@v6
59+
with:
60+
script: |
61+
const commentBody = `Playroom staging is available at ${process.env.DOMAIN}`;
62+
63+
const commentsList = await github.rest.issues.listComments({
64+
issue_number: context.issue.number,
65+
owner: context.repo.owner,
66+
repo: context.repo.repo,
67+
});
68+
69+
const comment = commentsList.data.find((comment) => comment.body.includes(commentBody));
70+
71+
if (!comment) {
72+
github.rest.issues.createComment({
73+
issue_number: context.issue.number,
74+
owner: context.repo.owner,
75+
repo: context.repo.repo,
76+
body: commentBody,
77+
})
78+
} else {
79+
github.rest.issues.updateComment({
80+
comment_id: comment.id,
81+
owner: context.repo.owner,
82+
repo: context.repo.repo,
83+
body: commentBody,
84+
})
85+
}
86+
87+
# - name: Deploy to production
88+
# # run on master branch
89+
# if: github.ref == 'refs/heads/master'
90+
# run: yarn components deploy:playroom --ci
91+
# env:
92+
# GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}

packages/orbit-components/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.out
66
.cache
77
.DS_STORE
8+
.playroom/
89
src/data/airportIllustrations.json
910
src/data/illustrations.json
1011
src/data/icons.json

packages/orbit-components/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828
"build:iconsFont": "node --loader ts-node/esm config/createSVGFont.mts",
2929
"build:emailIcons": "yarn build:icons && yarn build:iconsFont && node --loader ts-node/esm config/generateEmailIcons.mts",
3030
"build:storybook": "yarn build:icons && storybook build -c .storybook -o .out",
31+
"build:playroom": "playroom build",
3132
"eslint:check": "eslint . --report-unused-disable-directives",
3233
"test-ct": "playwright test -c playwright-ct.config.ts",
3334
"deploy:storybook": "yarn storybook-to-ghpages -e ./.out",
35+
"deploy:playroom": "yarn surge .playroom/",
3436
"deploy:surge": "yarn surge .out/",
3537
"docs-gen": "monstra docs"
3638
},

0 commit comments

Comments
 (0)