Merge pull request #11 from Byte-Magazine/dependabot/npm_and_yarn/mul… #121
This file contains hidden or 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: Deploy Workflow | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| deploy-pages: | |
| name: Deploy to GitHub Pages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Generate Authors | |
| run: npm run generate-authors | |
| - name: Build website | |
| run: npm run build | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| personal_token: ${{ secrets.PERSONAL_TOKEN }} | |
| external_repository: Byte-Magazine/Byte-Magazine.github.io | |
| publish_dir: ./build | |
| publish_branch: main | |
| deploy-server: | |
| name: Deploy to Production Server | |
| runs-on: ubuntu-latest | |
| needs: deploy-pages | |
| steps: | |
| - name: Deploy over SSH using appleboy/ssh-action | |
| uses: appleboy/ssh-action@v1.0.0 | |
| with: | |
| host: ${{ secrets.SERVER_IP }} | |
| username: ${{ secrets.SERVER_USER }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| port: 9011 | |
| script: | | |
| cd Byte-Magazine.github.io | |
| source ~/.bashrc | |
| git pull origin main | |
| sudo systemctl reload nginx |