Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] client, designsystem 간 모노레포 의존성 설정 #532

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
54 changes: 0 additions & 54 deletions .github/workflows/design-pull-request.yml

This file was deleted.

118 changes: 118 additions & 0 deletions .github/workflows/design-release-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Design System Pull Request

on:
workflow_dispatch:
inputs:
semver:
description: 'New Version(semver)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major

permissions:
contents: write # for checkout and commit
pull-requests: write # for create pr

jobs:

chromatic:
name: Run Chromatic
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.15.1'

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

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd client
npm install

- name: Run Chromatic
uses: chromaui/action@latest
id: publish_chromatic
with:
workingDir: client/packages/haengdong-design
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

- name: Comment on PR
uses: thollander/actions-comment-pull-request@v2
with:
message: '🚀 **storybook**: ${{ steps.publish_chromatic.outputs.storybookUrl }}'

create-release-pr:
name: Create Release PR
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./client
steps:
- name: checkout
uses: actions/checkout@v3
- name: Update Version
run: |
git config --global user.email "${GIT_AUTHOR_EMAIL}"
git config --global user.name "${GIT_AUTHOR_NAME}"
npm run ci:versionup:${SEMVER} --yes
env:
SEMVER: ${{ github.event.inputs.semver }}
GIT_AUTHOR_NAME: ${{ github.actor }}
GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com
- name: Set PACKAGE_VERSION
run: echo "PACKAGE_VERSION=$(cat lerna.json | jq -r .version)" >> $GITHUB_ENV
- name: Set GitHub Release Note
id: release_note
uses: actions/github-script@v6
with:
script: |
const result = await exec.getExecOutput(`gh api "/repos/{owner}/{repo}/releases/generate-notes" -f tag_name="v${process.env.PACKAGE_VERSION}" --jq .body`, [], {
ignoreReturnCode: true,
})
core.setOutput('stdout', result.stdout)
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore(release): v${{ env.PACKAGE_VERSION }}"
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
assignees: ${{ github.actor }}
signoff: false
branch: release/${{ env.PACKAGE_VERSION }}
branch-suffix: timestamp
delete-branch: true
title: 'v${{ env.PACKAGE_VERSION }}'
body: |
${{ steps.release_note.outputs.stdout }}
'🚀 **storybook**: ${{ steps.publish_chromatic.outputs.storybookUrl }}'
labels: "Type: Release"
- name: Check Pull Request
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"


112 changes: 112 additions & 0 deletions .github/workflows/design-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Design System Release

on:
pull_request:
branches:
- main
types: [ closed ]
workflow_dispatch: # for force release

jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./client
permissions:
contents: read
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
outputs:
EXISTS_TAG: ${{ steps.tag_check.outputs.EXISTS_TAG }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set PACKAGE_VERSION
run: echo "PACKAGE_VERSION=$(cat lerna.json | jq -r .version)" >> $GITHUB_ENV
- name: Tag Check
id: tag_check
run: |
GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/${TAG_NAME}"
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \
-H "Authorization: token ${GITHUB_TOKEN}")
if [ "$http_status_code" -ne "404" ] ; then
echo "EXISTS_TAG=true" >> $GITHUB_OUTPUT
else
echo "EXISTS_TAG=false" >> $GITHUB_OUTPUT
fi
env:
TAG_NAME: v${{ env.PACKAGE_VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./client
needs: check
if: always() && (needs.check.outputs.EXISTS_TAG == 'false')
permissions:
contents: write
issues: write
pull-requests: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '20.15.1'
registry-url: 'https://registry.npmjs.org'
- name: Git Identity
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set PACKAGE_VERSION
run: echo "PACKAGE_VERSION=$(cat lerna.json | jq -r .version)" >> $GITHUB_ENV
- name: Install
run: npm install
- name: Publish
run: npm run ci:release
env:
# actions/setup-node create .npmrc with `NODE_AUTH_TOKEN` env if `registry-url` is defined
# === `echo "${ registry-url }/:_authToken=${ NODE_AUTH_TOKEN }" > .npmrc`
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # [EXAMPLE]
# for publishing packages to npm
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Git Tag
uses: pkgdeps/git-tag-action@v2
with:
version: ${{ env.PACKAGE_VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_repo: ${{ github.repository }}
git_commit_sha: ${{ github.sha }}
git_tag_prefix: "v"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.PACKAGE_VERSION }}
# Copy Pull Request's tile and body to Release Note
name: ${{ github.event.pull_request.title }}
body: ${{ github.event.pull_request.body }}
draft: false
prerelease: false
generate_release_notes: ${{ !github.event.pull_request.body }}
- uses: actions/github-script@v6
if: github.event_name != 'workflow_dispatch'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🎉 Release https://github.com/${{ github.repository }}/releases/tag/v${{ env.PACKAGE_VERSION }}'
})
18 changes: 5 additions & 13 deletions .github/workflows/frontend-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: frontend-pull-request
name: Client Pull Request

on:
pull_request:
Expand Down Expand Up @@ -26,24 +26,16 @@ jobs:
node-version: '20.15.1'

- name: Install dependencies
working-directory: ./client
run: npm install

- name: Run build
run: npm run build

- name: Run lint
working-directory: ./client
run: npm run lint

- name: Run test
working-directory: ./client
run: npm run test

- name: Cypress test
run: npm run dev &
env:
CI: true

- name: Wait for the server to start
run: sleep 3

- name: Run Cypress tests
run: npm run cypress-run
run: npm run e2e
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

Loading