print secrets for debugging #4
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: Deploy to EC2 | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE20: true | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Build the app | ||
run: npm run build | ||
steps: | ||
- name: Print Secrets | ||
run: | | ||
echo "EC2 Host: ${{ secrets.EC2_HOST }}" | ||
echo "EC2 User: ${{ secrets.EC2_USER }}" | ||
echo "EC2 SSH Key: |" | ||
echo "${{ secrets.EC2_SSH_KEY }}" | ||
echo "This is just for debugging purposes. Make sure to remove it later." | ||
env: | ||
EC2_SSH_KEY: ${{ secrets.EC2_SSH_KEY }} | ||
- name: Copy files to EC2 | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USER }} | ||
key: ${{ secrets.EC2_SSH_KEY }} | ||
port: 22 | ||
source: "build/*" | ||
target: "/var/www/html/" | ||
- name: Restart Nginx | ||
run: | | ||
ssh -i ${{ secrets.EC2_SSH_KEY }} -o StrictHostKeyChecking=no ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "sudo systemctl reload nginx" |