Skip to content

Commit

Permalink
use ssh-action
Browse files Browse the repository at this point in the history
  • Loading branch information
guss84 committed Dec 1, 2023
1 parent 6aa6885 commit 5f9eebd
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/deploy_testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
LOGGING_LEVEL=${{ secrets.LOGGING_LEVEL_TESTING }}
DEPLOYMENT_TYPE=testing
" > .env
scp -o StrictHostKeyChecking=no -i private_key ./.env ${USER_NAME}@${HOSTNAME}:.env
- name: build docker image with correct tags
working-directory: ./rest
Expand All @@ -94,20 +95,13 @@ jobs:
docker push "$TESTING_ECR_REGISTRY/$TESTING_ECR_REGISTRY_IMAGE:latest"
- name: pull docker image and run
working-directory: ./rest
run: |
echo "${PRIVATE_KEY}" > private_key && chmod 600 private_key
scp -o StrictHostKeyChecking=no -i private_key ./.env ${USER_NAME}@${HOSTNAME}:.env
ssh -o StrictHostKeyChecking=no -T -i private_key ${USER_NAME}@${HOSTNAME} '
# Now we have got the access of EC2 and we will start the deploy .
echo "$DEPLOYMENT_NAME" > test.txt
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin "$TESTING_ECR_REGISTRY/$TESTING_ECR_REGISTRY_IMAGE:$GITHUB_REF_NAME"
docker pull 127163565383.dkr.ecr.eu-central-1.amazonaws.com/openeo-dev-ec2:latest
# stop and remove all containers
docker ps -aq | xargs docker stop | xargs docker rm
docker run -p 8000:8000 -d --env-file .env 127163565383.dkr.ecr.eu-central-1.amazonaws.com/openeo-dev-ec2:latest
'
uses: appleboy/[email protected]
with:
key: ${{ secrets.TESTING_SSH_PRIVATE_KEY }}
host: ${{ secrets.TESTING_SSH_HOST }}
username: ${{ secrets.TESTING_USER_NAME }}
envs: DEPLOYMENT_NAME
script: echo "$DEPLOYMENT_NAME" > test.txt



Expand Down

0 comments on commit 5f9eebd

Please sign in to comment.