Skip to content

Commit

Permalink
chore: change storybook staging URL
Browse files Browse the repository at this point in the history
  • Loading branch information
DSil committed Jan 31, 2024
1 parent 436d54f commit e871c7e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 39 deletions.
42 changes: 33 additions & 9 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
- name: Build Storybook
run: yarn components build:storybook

# TODO: find an alternative to using "if" statements for so many steps

- name: Get BRANCH_URL
# do not run on master branch
if: github.ref != 'refs/heads/master'
Expand All @@ -45,16 +43,42 @@ jobs:

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

- name: Deploy to staging
if: github.ref != 'refs/heads/master'
# we're adding to the domain name the username of the current owner of SURGE_TOKEN
run: |
yarn components deploy:surge ${DOMAIN} --token ${{ secrets.SURGE_TOKEN }}
yarn components deploy:updateURL --pr=${PR_NUMBER} --lastUrl=${DOMAIN} --token=${{ secrets.OCTO_TOKEN }} --urlName=Storybook
env:
PR_NUMBER: ${{ github.event.number }}
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 = `Storybook 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
Expand Down
29 changes: 0 additions & 29 deletions packages/orbit-components/config/deploymentUtils.mts

This file was deleted.

1 change: 0 additions & 1 deletion packages/orbit-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"test-ct": "playwright test -c playwright-ct.config.ts",
"deploy:storybook": "yarn storybook-to-ghpages -e ./.out",
"deploy:surge": "yarn surge .out/",
"deploy:updateURL": "node --loader ts-node/esm config/deploymentUtils.mts updateLiveURL",
"docs-gen": "monstra docs"
},
"storybook-deployer": {
Expand Down

0 comments on commit e871c7e

Please sign in to comment.