DavDeDev is deploying DisCal #20
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: build-to-codeDeploy | |
# | |
run-name: ${{ github.actor }} is deploying ${{ github.event.repository.name }} | |
on: | |
push: | |
branches: | |
- main | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_id | |
jobs: | |
deploy: | |
name: Set-up | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🟢 Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: latest | |
- name: 📥 Clone repo | |
uses: actions/checkout@v3 | |
- name: 📦 Install packages | |
run: npm i | |
# https://stackoverflow.com/a/63350136/18686901 | |
- name: 🔒 Import secrets | |
run: | | |
echo "${{ secrets.ENV_FILE }}" > .env | |
- name: 🔨 Build project | |
run: npm run build | |
- name: 🚇 SSH to EC2 and deploy | |
uses: easingthemes/ssh-deploy@v4.1.8 | |
# `SSH_PRIVATE_KEY`, `REMOTE_HOST`, `REMOTE_USER` | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY }} | |
REMOTE_HOST: ${{ secrets.HOST_DNS }} | |
REMOTE_USER: ${{ secrets.USERNAME }} | |
ARGS: -rlgoDzv -i | |
EXCLUDE: | | |
src/, | |
node_modules/, | |
public/, | |
.github/, | |
.git/ | |
TARGET: /home/${{ secrets.USERNAME }}/DisCal/ |