π Deploy to AWS #70
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 AWS | |
on: | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: π οΈ Checkout | |
uses: actions/checkout@v4 | |
- name: π¦ Install Client Dependencies | |
run: npm ci --ignore-scripts | |
working-directory: ./client | |
- name: π¨ Build Client | |
run: npm run build | |
working-directory: ./client | |
- name: π¦ Install Server Dependencies | |
run: npm ci --ignore-scripts | |
working-directory: ./server | |
- name: π¨ Build Server | |
run: npm run build | |
working-directory: ./server | |
- name: π§ͺ Run Unit Tests (FE) | |
run: npm run test:unit | |
working-directory: ./client | |
- name: π§ͺ Run Unit Tests (BE) | |
run: npm run test:unit | |
working-directory: ./server | |
- name: 𧩠Combine Client and Server | |
run: | | |
mkdir -p ./server/dist/public | |
cp -r ./client/dist/* ./server/dist/public/ | |
working-directory: . | |
- name: π Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}} | |
aws-secret-access-key: ${{secrets.AWS_SECRET_ACCESS_KEY}} | |
aws-region: ${{secrets.AWS_REGION}} | |
- name: π οΈ Install Elastic Beanstalk CLI | |
run: | | |
sudo apt-get install -y python3-pip | |
pip3 install awsebcli --upgrade --user | |
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $HOME/.bashrc | |
source $HOME/.bashrc | |
- name: π± Init Elastic Beanstalk | |
run: echo "n" | eb init crypto-guesser --region ${{secrets.AWS_REGION}} | |
working-directory: ./server | |
- name: π Deploy to Elastic Beanstalk | |
run: eb deploy crypto-guesser-env | |
working-directory: ./server |