Skip to content

Commit

Permalink
feat(*): 自动化构建
Browse files Browse the repository at this point in the history
  • Loading branch information
江芊 committed Jan 6, 2022
1 parent b9bcc79 commit 827adb2
Show file tree
Hide file tree
Showing 2 changed files with 1,090 additions and 1,213 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: myblog2.0-admin
on:
push:
tags:
- 'v*'

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 下载源码
- name: Checkout
uses: actions/checkout@master
# 打包构建
- name: Build
uses: actions/setup-node@master
- run: npm install
- run: npm run build
- run: tar -zcvf release.tgz dist
# 发布 Release
- name: Create Release
id: create_release
uses: actions/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
# 上传构建结果到 Release
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}

asset_path: ./release.tgz
asset_name: release.tgz
asset_content_type: application/x-tgz
# 部署到服务器
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
cd /home/www/Aimee/myblog2.0-admin
wget https://github.com/Aimee1608/myblog2.0-admin/releases/latest/download/release.tgz -O release.tgz
tar zxvf release.tgz
Loading

0 comments on commit 827adb2

Please sign in to comment.