feat: 1. table header 添加时间组件; 2. table footer 动态宽度计算; 3. 定时任务状态对应操作项修改 #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Preview Frontend | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build_and_pack_frontend: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install required packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y zip unzip | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '22.7' | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 9.9.0 | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build project | |
run: pnpm build | |
- name: Get date and commit hash | |
run: | | |
echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
echo "COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV | |
- name: Truncate commit hash | |
run: | | |
HASH=${{ env.COMMIT_HASH }} | |
TRUNCATED_HASH=${HASH:0:8} | |
echo "TRUNCATED_HASH=${TRUNCATED_HASH}" >> $GITHUB_ENV | |
- name: Zip dist directory | |
run: zip -r preview-dist.zip ./dist | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: preview-dist.zip | |
path: ./preview-dist.zip | |
release: | |
needs: | |
- build_and_pack_frontend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Download From Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: preview-dist.zip | |
- name: Set release name | |
run: | | |
DATE=$(date +"%Y%m%d") | |
SHORT_COMMIT_HASH=$(git rev-parse --short HEAD) | |
echo "RELEASE_NAME=v${DATE}-${SHORT_COMMIT_HASH}" >> $GITHUB_ENV | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
tag_name: ${{ env.RELEASE_NAME }} | |
release_name: Release Preview ${{ env.RELEASE_NAME }} | |
draft: false | |
prerelease: false | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: preview-dist.zip | |
asset_name: preview-dist.zip | |
asset_content_type: application/zip | |
deploy_to_server: | |
needs: | |
- build_and_pack_frontend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download From Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: preview-dist.zip | |
- name: Backup existing files | |
uses: appleboy/ssh-action@master | |
with: | |
host: legion-4g.yaklang.io | |
username: root | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd /root/ | |
if [ -d "preview-dist.zip" ]; then | |
mv preview-dist.zip preview-dist.zip.$(date +"%Y%m%d").bak | |
fi | |
- name: Upload dist files | |
uses: appleboy/scp-action@master | |
with: | |
host: legion-4g.yaklang.io | |
username: root | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
source: preview-dist.zip | |
target: /root/ | |
- name: Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: legion-4g.yaklang.io | |
username: root | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd /root/ | |
unzip -o preview-dist.zip | |
rm preview-dist.zip |