热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

利用githubactions部署vue项目

准备工作参考我的另一篇利用githubactions自动部署gradle构建的springboot项目打包的war包到tomcat服务器,这里直接上配置,

准备工作参考我的另一篇利用github actions自动部署gradle构建的springboot 项目打包的war包到tomcat服务器,这里直接上配置,关键的地方都写了注释

# This is a basic workflow to help you get started with Actionsname: CI# Controls when the action will run.
on:# Triggers the workflow on push or pull request events but only for the master branchpush:branches: [ master ]pull_request:branches: [ master ]# Allows you to run this workflow manually from the Actions tabworkflow_dispatch:# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:# This workflow contains a single job called "build"build:# The type of runner that the job will run onruns-on: ubuntu-latest# Steps represent a sequence of tasks that will be executed as part of the jobsteps:# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it- uses: actions/checkout@v2- uses: actions/setup-node@v2 #nodejs 环境with:node-version: '14' #nodejs 版本- run: yarn install #安装依赖- run: yarn build:prod #打包- name: Tar dist filerun: |tar -zcvf webapp.tar.gz dist # 打包dist文件夹- name: Scp_upload_tar_file # 上传至服务器uses: garygrossgarten/github-action-scp@releasewith:local: 'webapp.tar.gz'remote: '/home/webapp.tar.gz'host: ${{ secrets.HOST }}username: ${{ secrets.USERNAME }}password: ${{ secrets.PASSWORD }}port: ${{ secrets.PORT }}- name: Deploy_app_tar #解压压缩包uses: appleboy/ssh-action@masterwith:host: ${{ secrets.HOST }}username: ${{ secrets.USERNAME }}password: ${{ secrets.PASSWORD }}port: ${{ secrets.PORT }}script: |cd /home/rm -rf disttar -zxvf webapp.tar.gzrm -rf /var/html/webappmv dist /var/html/webapp

推荐阅读
author-avatar
手机用户2502925763
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有