Skip to content

Commit

Permalink
Merge branch 'develop' into mochi-web-preview
Browse files Browse the repository at this point in the history
  • Loading branch information
lmquang committed Feb 21, 2024
2 parents bb0d5f9 + 17b9916 commit cf38000
Show file tree
Hide file tree
Showing 10 changed files with 1,148 additions and 21 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/deploy-mochi-web-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Vercel Preview Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
release:
types: [prereleased]
jobs:
Deploy-Preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
workflow_dispatch:
release:
types: [released]
jobs:
Deploy-Production:
runs-on: ubuntu-latest
Expand All @@ -23,5 +25,7 @@ jobs:
run: pnpm add --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prod --no-wait --token=${{ secrets.VERCEL_TOKEN }}
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/release-web.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release web

on:
push:
branches:
- cicd
- main
- mochi-web-preview

permissions:
contents: read # for checkout

jobs:
release-web:
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 # v3
with:
fetch-depth: 0 # to be able to checkout any commit
persist-credentials: false # <--- this
- uses: pnpm/action-setup@v2
with:
version: 6.32.9
- uses: actions/setup-node@v3 # v3
with:
cache: pnpm
node-version: 18
- name: Install dependencies
run: pnpm install
# pinned version updated automatically by Renovate.
# details at https://semantic-release.gitbook.io/semantic-release/usage/installation#global-installation
- run: pnpm dlx [email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
32 changes: 32 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"branches": [
"main",
{
"name": "mochi-web-preview",
"prerelease": "rc"
},
{
"name": "cicd",
"prerelease": "ci"
}
],
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/npm",
{
"npmPublish": false,
"pkgRoot": "apps/mochi-web"
}
],
[
"@semantic-release/github",
{
"successComment": false
}
],
["@semantic-release/git", {
"assets": ["apps/mochi-web/package.json"]
}]
]
}
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
RELEASE_BRANCH=main
BETA_BRANCH=mochi-web-preview
DEVELOP_BRANCH=develop

.PHONY: release
release:
git checkout $(BETA_BRANCH) && git pull origin $(BETA_BRANCH) && \
git checkout $(RELEASE_BRANCH) && git pull origin $(RELEASE_BRANCH) && \
git merge $(BETA_BRANCH) --no-edit --no-ff && \
git push origin $(RELEASE_BRANCH) && \
git checkout $(DEVELOP_BRANCH)

.PHONY: release-preview
release-preview: sync-release
git checkout $(DEVELOP_BRANCH) && git pull origin $(DEVELOP_BRANCH) && \
git checkout $(BETA_BRANCH) && git pull origin $(BETA_BRANCH) && \
git merge $(DEVELOP_BRANCH) --no-edit --no-ff && \
git push origin $(BETA_BRANCH) && \
git checkout $(DEVELOP_BRANCH) && git push origin $(DEVELOP_BRANCH)

.PHONY: sync-release
sync-release:
git checkout $(RELEASE_BRANCH) && git pull origin $(RELEASE_BRANCH) && \
git checkout $(BETA_BRANCH) && git pull origin $(BETA_BRANCH) && \
git merge $(RELEASE_BRANCH) --no-edit --no-ff
5 changes: 1 addition & 4 deletions apps/mochi-web/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client'

import { isMobile } from '~utils/isMobile'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { ROUTES } from '~constants/routes'
Expand Down Expand Up @@ -551,9 +550,7 @@ export const Header = () => {
<DesktopNav
navItems={desktopNavItems}
className={
isLoggedIn && profile && isMobile() && window.innerWidth <= 1024
? '!flex'
: ''
isLoggedIn && profile && window.innerWidth <= 1024 ? '!flex' : ''
}
/>
</>
Expand Down
2 changes: 1 addition & 1 deletion apps/mochi-web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mochi-web",
"private": true,
"version": "1.2.1",
"version": "1.0.0-ci.5",
"scripts": {
"proxy-ssl": "local-ssl-proxy --config proxy-config.json",
"dev:https": "(trap 'kill 0' SIGINT; pnpm proxy-ssl & next dev -p 3001)",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@changesets/cli": "^2.27.1",
"@commitlint/cli": "^17.8.0",
"@commitlint/config-conventional": "^17.8.0",
"@semantic-release/git": "^10.0.1",
"@storybook/react": "^7.4.6",
"@swc-node/jest": "^1.6.8",
"@swc/core": "^1.3.96",
Expand Down
Loading

0 comments on commit cf38000

Please sign in to comment.