Skip to content

fix(deploy): repair rsync #5

fix(deploy): repair rsync

fix(deploy): repair rsync #5

Workflow file for this run

name: DEPLOY_TO_EC2
on:
workflow_dispatch:
push:
pull_request:
branches:
- main
permissions:
id-token: write # This is required for requesting the JWT
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- name: Install WebAssembly target
run: rustup target add wasm32-unknown-unknown
- name: Install trunk
run: cargo install trunk
- name: Build the project
run: trunk build --release
- name: Config AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::471112525273:role/github-oidc
aws-region: ${{ secrets.AWS_REGION }}
- name: Deploy to EC2
env:
PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
HOST: ${{ secrets.EC2_HOST }}
USER: ${{ secrets.EC2_USER }}
run: |
echo "$PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
rsync -avzr --delete --exclude '.git/' --exclude '.github/' -e "ssh -i private_key.pem -o StrictHostKeyChecking=no" ./dist/ $USER@$HOST:~/dist
rm -f private_key.pem