Skip to content

Commit

Permalink
chore: add Playroom deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
sarkaaa committed Jan 15, 2025
1 parent a48bd0d commit 7385644
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/delete-tests-reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ jobs:
uses: ./.github/actions/node

- name: Delete Report
# yarn surge teardown $DOMAIN_PLAYROOM --token ${{ secrets.SURGE_TOKEN }}
run: |
echo "Deleting report for branch $BRANCH_NAME"
BRANCH_URL=$(echo ${BRANCH_NAME} | sed -e 's/[^a-zA-Z0-9]/-/g')
DOMAIN=https://kiwicom-orbit-test-report-${BRANCH_URL}.surge.sh
DOMAIN_PLAYROOM=https://kiwicom-orbit-test-report-${BRANCH_URL}-playroom.surge.sh
yarn surge teardown $DOMAIN --token ${{ secrets.SURGE_TOKEN }}
continue-on-error: true
92 changes: 92 additions & 0 deletions .github/workflows/playroom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Playroom

on:
push:
branches:
- master
pull_request:
branches:
- "**"

env: # Set environment variables for every job and step in this workflow
CLICOLOR: "1" # Enable colors for *NIX commands
PY_COLORS: "1" # Enable colors for Python-based utilities
FORCE_COLOR: "1" # Force colors in the terminal

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
pull-requests: write # for dependabot
contents: write # for deploying to GitHub Pages on master
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Node
uses: ./.github/actions/node

- name: Compile design tokens
run: yarn tokens build

- name: Build tailwind
run: yarn tailwind-preset build

- name: Build components
run: yarn components build

- name: Build Playroom
run: yarn components build:playroom

- name: Get BRANCH_URL
# do not run on master branch
if: github.ref != 'refs/heads/master'
env:
BRANCH_NAME: ${{ github.head_ref }}
run: echo "BRANCH_URL=$(sed -e 's/[^a-zA-Z0-9]/-/g' <<< ${BRANCH_NAME})" >> $GITHUB_ENV

- name: Get DOMAIN
if: github.ref != 'refs/heads/master'
run: echo "DOMAIN=https://kiwicom-orbit-playroom-${BRANCH_URL}.surge.sh" >> $GITHUB_ENV

- name: Deploy to staging
if: github.ref != 'refs/heads/master'
run: yarn components deploy:surge ${DOMAIN} --token ${{ secrets.SURGE_TOKEN }}

- name: Add comment to PR
if: github.ref != 'refs/heads/master'
uses: actions/github-script@v6
with:
script: |
const commentBody = `Playroom staging is available at ${process.env.DOMAIN}`;
const commentsList = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const comment = commentsList.data.find((comment) => comment.body.includes(commentBody));
if (!comment) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody,
})
} else {
github.rest.issues.updateComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody,
})
}
# - name: Deploy to production
# # run on master branch
# if: github.ref == 'refs/heads/master'
# run: yarn components deploy:playroom --ci
# env:
# GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions packages/orbit-components/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.out
.cache
.DS_STORE
.playroom/
src/data/airportIllustrations.json
src/data/illustrations.json
src/data/icons.json
Expand Down
2 changes: 2 additions & 0 deletions packages/orbit-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
"build:iconsFont": "node --loader ts-node/esm config/createSVGFont.mts",
"build:emailIcons": "yarn build:icons && yarn build:iconsFont && node --loader ts-node/esm config/generateEmailIcons.mts",
"build:storybook": "yarn build:icons && storybook build -c .storybook -o .out",
"build:playroom": "playroom build",
"eslint:check": "eslint . --report-unused-disable-directives",
"test-ct": "playwright test -c playwright-ct.config.ts",
"deploy:storybook": "yarn storybook-to-ghpages -e ./.out",
"deploy:playroom": "yarn surge .playroom/",
"deploy:surge": "yarn surge .out/",
"docs-gen": "monstra docs"
},
Expand Down

0 comments on commit 7385644

Please sign in to comment.