|
1 | | -# Simple workflow for deploying static content to GitHub Pages |
2 | | -name: Deploy static content to Pages |
| 1 | +name: Deploy to Reg.Ru Hosting |
3 | 2 |
|
4 | 3 | on: |
5 | | - # Runs on pushes targeting the default branch |
6 | 4 | push: |
7 | | - branches: ["master"] |
| 5 | + branches: [main] |
8 | 6 |
|
9 | | - # Allows you to run this workflow manually from the Actions tab |
10 | | - workflow_dispatch: |
| 7 | +env: |
| 8 | + SERVER_HOST: "31.31.198.56" |
| 9 | + USERNAME: "u2970963" |
| 10 | + PASSWORD: ${{ secrets.SSH_PASSWORD_REGRU }} |
| 11 | + DEPLOY_PATH: /www/otk-help.martinmeer.com |
11 | 12 |
|
12 | | -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
13 | | -permissions: |
14 | | - contents: read |
15 | | - pages: write |
16 | | - id-token: write |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v3 |
17 | 19 |
|
18 | | -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
19 | | -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
20 | | -concurrency: |
21 | | - group: "pages" |
22 | | - cancel-in-progress: false |
| 20 | + - name: Install dependencies |
| 21 | + run: | |
| 22 | + npm install |
| 23 | +
|
| 24 | + - name: Build project |
| 25 | + run: | |
| 26 | + npm run build |
| 27 | +
|
| 28 | + - name: Archive production artifacts |
| 29 | + uses: actions/upload-artifact@v3 |
| 30 | + with: |
| 31 | + name: dist |
| 32 | + path: ./dist |
23 | 33 |
|
24 | | -jobs: |
25 | | - # Single deploy job since we're just deploying |
26 | 34 | deploy: |
27 | | - environment: |
28 | | - name: github-pages |
29 | | - url: ${{ steps.deployment.outputs.page_url }} |
| 35 | + needs: build |
30 | 36 | runs-on: ubuntu-latest |
31 | 37 | steps: |
32 | | - - name: Checkout |
33 | | - uses: actions/checkout@v4 |
34 | | - - name: Setup Pages |
35 | | - uses: actions/configure-pages@v5 |
36 | | - - name: Upload artifact |
37 | | - uses: actions/upload-pages-artifact@v3 |
| 38 | + - name: Download artifacts |
| 39 | + uses: actions/download-artifact@v3 |
38 | 40 | with: |
39 | | - # Upload entire repository |
40 | | - path: '.' |
41 | | - - name: Deploy to GitHub Pages |
42 | | - id: deployment |
43 | | - uses: actions/deploy-pages@v4 |
| 41 | + name: dist |
| 42 | + |
| 43 | + - name: Install sshpass |
| 44 | + run: sudo apt-get update && sudo apt-get install -y sshpass |
| 45 | + |
| 46 | + - name: Copy files to server |
| 47 | + env: |
| 48 | + SSH_PASSWORD: ${{ secrets.SSH_PASSWORD_REGRU }} |
| 49 | + run: | |
| 50 | + sshpass -p $SSH_PASSWORD scp -r dist/* $USERNAME@$SERVER_HOST:$DEPLOY_PATH |
0 commit comments