From c19bf23a4c81e12fd8a581f45ce78450b89c5f6c Mon Sep 17 00:00:00 2001 From: kenan <166354929+kenanaptx4869@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:09:04 +0800 Subject: [PATCH] Update main.yml --- .github/workflows/main.yml | 40 +++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 371a127..86ad0f1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ on: # Environment variables available to all jobs and steps in this workflow permissions: - contents: read + contents: write jobs: build: @@ -33,21 +33,33 @@ jobs: run: npm run build - # - name: Deploy to GitHub Pages - # uses: JamesIves/github-pages-deploy-action@v4 - # if: ${{ github.ref == 'refs/heads/main' }} - # with: - # branch: gh-pages//这个是存储你项目打包后的文件分支 - # folder: dist - # # token: ${{ secrets.TOKEN }} - + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + # if: ${{ github.ref == 'refs/heads/main' }} + with: + branch: gh-pages # 这个是存储你项目打包后的文件分支 + folder: dist + # token: ${{ secrets.TOKEN }} + - - name: copy dist file with scp - uses: appleboy/scp-action@v0.0.1 + - name: Deploy to server + uses: appleboy/ssh-action@master with: host: ${{ secrets.REMOTE_HOST }} username: ${{ secrets.REMOTE_USER }} password: ${{ secrets.REMOTE_PASS }} - port: 22 - source: 'dist/' - target: '/www/wwwroot/8.152.0.253/something0408/' + port: ${{ secrets.REMOTE_PORT }} + script: | + cd /www/wwwroot/8.152.0.253/something0408 # 替换为您的项目在服务器上的位置 + git pull origin gh-pages # 拉取最新代码 + + + # - name: copy dist file with scp + # uses: appleboy/scp-action@v0.0.1 + # with: + # host: ${{ secrets.REMOTE_HOST }} + # username: ${{ secrets.REMOTE_USER }} + # password: ${{ secrets.REMOTE_PASS }} + # port: 22 + # source: 'dist/' + # target: '/www/wwwroot/8.152.0.253/something0408/'