Skip to content

Instantly share code, notes, and snippets.

@alanleyva
Created January 4, 2021 23:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanleyva/c135c954389accf62f8ca32446569be0 to your computer and use it in GitHub Desktop.
Save alanleyva/c135c954389accf62f8ca32446569be0 to your computer and use it in GitHub Desktop.
Github Action para correr build y publicar React.js en cualquier servidor
name: Build and Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@main
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Archive Production Artifact
uses: actions/upload-artifact@master
with:
name: build
path: build
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@master
with:
name: build
path: build
- name: Copying files to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: user_name
key: ${{ secrets.SSH_KEY }}
# rm: true
# port: 22 //puedes especificar el puerto si es necesario para tu servidor
source: "build/"
target: "${{ secrets.REMOTE_DIR }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment