-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b830b8b
commit 7e3e564
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Deploy to PROD-GLA | ||
on: | ||
push: | ||
branches: | ||
- prod | ||
jobs: | ||
build: | ||
name: Generate Build and Deploy to DEV | ||
# environment: PROD | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node Env | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 21.1.0 | ||
|
||
# - name: Copy .env file | ||
# env: | ||
# ENV_FILE_CONTENT: ${{ secrets.env }} | ||
# run: echo "$ENV_FILE_CONTENT" > .env | ||
|
||
- name: Generate React Build | ||
run: | | ||
yarn install | ||
yarn build | ||
- name: Show PWD | ||
run: | | ||
echo "Current Working Directory:" | ||
pwd | ||
- name: Create Directory | ||
run: mkdir my_directory | ||
|
||
- name: List Contents | ||
run: | | ||
echo "Contents of the current directory (in reverse order):" | ||
ls -lr | ||
- name: Deploy to Server 1 | ||
uses: easingthemes/ssh-deploy@main | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY_GLA_PROD }} | ||
REMOTE_HOST: ${{ secrets.HOST_DNS_GLA_PROD }} | ||
REMOTE_USER: ${{ secrets.USERNAME_GLA_PROD }} | ||
|
||
|
||
- name: Set up SSH key | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.EC2_SSH_KEY_NEWALTV1_DEV }}" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
# Add the SSH key to the known_hosts file (replace hostname with your actual hostname) | ||
ssh-keyscan -H ${{ secrets.HOST_DNS_GLA_PROD }} >> ~/.ssh/known_hosts | ||
- name: Copy Package | ||
run: | | ||
sh ./scripts/pack-prod-build.sh | ||
rsync shiksha-ui.tar ${{ secrets.USERNAME_GLA_PROD }}@${{ secrets.HOST_DNS_GLA_PROD }}:/var/www/alt-palooza.uniteframework.io/shiksha-ui.tar | ||
- name: Deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST_DNS_GLA_PROD }} | ||
username: ${{ secrets.USERNAME_GLA_PROD }} | ||
key: ${{ secrets.EC2_SSH_KEY_GLA_PROD }} | ||
script: | | ||
cd /var/www/alt-palooza.uniteframework.io/public | ||
rm -rf * | ||
cp ../shiksha-ui.tar ./ | ||
tar -xvf shiksha-ui.tar . | ||