Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/link_pr_to_issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: link_pr_to_issue

on:
pull_request:
types: [opened]
branches-ignore:
- main

jobs:
append_issue_number_to_pr_body:
runs-on: ubuntu-latest
steps:
- name: append feature number to pr body pr branch = feat/(issueNumber)
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
const body = pr.data.body;
const issueNumber= pr.data.head.ref.split('/')[1];
const labels = pr.data.labels;

const isFeLabelPresent = labels.some(label => label.name === "FE");

const storybook_link = isFeLabelPresent ? "🚀 **[Storybook](https://storybook.carffe.in/)**" : "";

const newBody = body + "\n\n" + "close #" + issueNumber + "\n\n" + storybook_link;
await github.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
body: newBody
});
54 changes: 39 additions & 15 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,66 @@
name: Storybook Deployment
run-name: ${{ github.actor }}의 스토리북 배포

on:
pull_request:
branches:
- develop

jobs:
storybook:
runs-on: ubuntu-20.04
deploy:
runs-on: ubuntu-latest
permissions: write-all
outputs:
status: ${{ job.status }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
strategy:
matrix:
node-version: [18.x]

steps:
- name: checkout repository
- name: Use repository source
uses: actions/checkout@v3

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
fetch-depth: 0
node-version: ${{ matrix.node-version }}

- name: cache dependencies
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-storybook
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: depedency install
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: publish to chromatic
id: chromatic
uses: chromaui/action@v1
- name: Set PUBLIC_URL
run: |
PUBLIC_URL=$(echo $GITHUB_REPOSITORY | sed -r 's/^.+\/(.+)$/\/\1\//')
echo PUBLIC_URL=$PUBLIC_URL > .env

- name: Build App
run: npm run build

- name: Build Storybook
run: |
npm run build-storybook
mv ./storybook-static ./dist/storybook

- name: Deploy To 'gh-pages' Branch
uses: peaceiris/actions-gh-pages@v3
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist

- name: comment PR
uses: thollander/actions-comment-pull-request@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: '🚀storybook: ${{ steps.chromatic.outputs.storybookUrl }}'
message: '🚀storybook: https://car-ffeine.github.io/react-without-cra/storybook'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
dist
.env
storybook-static
build-storybook.log
storybook-static
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint-staged
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
<a href="https://dev.to/alekseiberezkin/setting-up-react-typescript-app-without-create-react-app-oph" target="_blank">
참고 링크
</a>

test
Loading