Skip to content

Commit

Permalink
Merge pull request #10 from xalc/master
Browse files Browse the repository at this point in the history
github action
  • Loading branch information
xalc authored Dec 12, 2024
2 parents ff041e1 + b27352f commit 6011313
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 25 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/deployecs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy to aliyun ECS
on:
push:
branches:
- production
workflow_dispatch:
env:
ATLAS_CLUSTER: ${{ vars.ATLAS_CLUSTER }}
ATLAS_NAME: ${{ vars.ATLAS_NAME }}
ATLAS_PD: ${{ secrets.ATLAS_PD }}
CREDLY_USER: ${{ vars.CREDLY_USER }}
MONGO_DATABASE: ${{ vars.MONGO_DATABASE }}
USE_ATLAS_DATABASE: ${{ vars.USE_ATLAS_DATABASE }}
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment || 'ecs' }}
steps:
- name: check env
run: |
echo "**** ${{ env.MONGO_DATABASE }} ${{ vars.MONGO_DATABASE }} ${{ secrets.ALIYUN_ECS_USER }}!"
- name: Checkout code
uses: actions/checkout@v3

- name: Install dependencies
run: |
yarn install --legacy-peer-deps
yarn run build
- name: Archive build artifacts
run: |
tar -czf build_artifacts.tar.gz .next public node_modules package.json
- name: Setup SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.ALIYUN_SERVER_PRIVATE_KEY }}

- name: Deploy to ECS
env:
ECS_HOST: ${{ secrets.ALIYUN_SERVER_HOST }}
ECS_USER: ${{ secrets.ALIYUN_ECS_USER }}

run: |
scp -o StrictHostKeyChecking=no build_artifacts.tar.gz $ECS_USER@$ECS_HOST:/root/Documents/deployment
ssh -o StrictHostKeyChecking=no $ECS_USER@$ECS_HOST << 'EOF'
cd /root/Documents/deployment
tar -xzf build_artifacts.tar.gz
cp .next public node_modules /root/Documents/knowledeg-center -rf
cd /root/Documents/knowledeg-center
echo $PATH
source ~/.bashrc
export NVM_DIR="$HOME/.nvm" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm use 20
node --version
pm2 restart knowledge
EOF
34 changes: 14 additions & 20 deletions src/app/blog/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@

import { createStyles } from 'antd-style';
import { ThemeProvider } from 'antd-style';
import { Flex } from 'antd';
const useStyles = createStyles(({ css }) => ({
layout: css`
display: flex;
flex-direction: column;
flex: 1;
`,
cover: css`
height: 200px;
width: 100vw;
overflow: hidden;
`,
container: css`
width: 80%;
align-self: center;
overflow: auto;
height: calc(100vh - 400px);
min-width:400px;
margin: 32px;
width: 80%;
min-width: 400px;
max-width: 1000px;
`,
image: css`
object-fit: cover;
Expand All @@ -26,7 +28,7 @@ const useStyles = createStyles(({ css }) => ({
export default function BlogContainerLayout({ children }) {
const { styles } = useStyles();

return <>
return <div className={styles.layout}>
<div className={styles.cover}>
<img className={styles.image} src='https://images.unsplash.com/photo-1521587760476-6c12a4b040da?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&w=6000'></img>
</div>
Expand All @@ -37,17 +39,9 @@ export default function BlogContainerLayout({ children }) {
lineHeight: 1.75
},
}}>
<Flex vertical align='center'>
<div className={styles.container}>
{children}
</div>
</Flex>
<div className={styles.container}>
{children}
</div>
</ThemeProvider>






</>
</div>
}
4 changes: 3 additions & 1 deletion src/components/credly.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ const useStyles = createStyles(({ token, css }) => ({
},
container: {
margin: token.margin,
height: 'inherit',
overflow: 'auto'
},
badgeContainer: {
height: 'calc(100vh - 320px)',

overflow: 'auto',
},
profile1: css`
Expand Down
11 changes: 7 additions & 4 deletions src/components/uilayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { usePathname } from 'next/navigation'
import { Layout, theme } from 'antd';
import { createStyles, ThemeProvider } from 'antd-style';
import ResponseHeader from './responseHeader.js';
const { Footer, Content } = Layout;
const { Content } = Layout;
const useStyles = createStyles(({ css, token }) => {
return {
layout: css`
Expand All @@ -16,7 +16,10 @@ const useStyles = createStyles(({ css, token }) => {
background-color: inherit;
`,
content: css`
height: calc(100vh - 130px);
flex: 1 1 0;
display: flex;
justify-content: center;
`,
footer: css`
display: flex;
Expand All @@ -40,9 +43,9 @@ export default function UILayout({ children }) {
return <>
<ResponseHeader />
<Content className={styles.content}>{children}</Content>
<Footer className={styles.footer}>
{/* <Footer className={styles.footer}>
HunterX ©2024 developed in Xi&apos;an
</Footer>
</Footer> */}
</>
}
return (
Expand Down

0 comments on commit 6011313

Please sign in to comment.