Update main.yml #5
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: kenan actions | |
on: | |
push: | |
branches: [ "main" ] | |
# Environment variables available to all jobs and steps in this workflow | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: node install | |
uses: actions/[email protected] | |
with: | |
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0. | |
node-version: "20.X" # optional | |
- name: INSTALL NODE MODULES | |
run: npm i | |
- name: Build | |
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 server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
password: ${{ secrets.REMOTE_PASS }} | |
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/[email protected] | |
# 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/' |