Create deploy.yml #1
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 React Homepage | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
name: π Build and Deploy | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x, 22.x] | |
steps: | |
- name: π Checkout Code | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: π¨ Install Dependencies | |
run: npm ci | |
- name: π¨ Build Project | |
run: npm run build --if-present | |
# - name: π¨ Run Tests | |
# run: npm test | |
- name: π List Output Files | |
run: find build/ -print | |
- name: π Sync Files via FTP | |
uses: SamKirkland/FTP-Deploy-Action@4.3.0 | |
with: | |
server: ${{ secrets.FTP_ADDRESS }} | |
username: ${{ secrets.FTP_USERNAME }} | |
password: ${{ secrets.FTP_PASSWORD }} | |
local-dir: build/ | |
server-dir: /public_html/home |