From ae375c2cede1ffe1c9edeab6cfb3bf0550d7d663 Mon Sep 17 00:00:00 2001 From: heyethereum Date: Wed, 19 Jun 2024 01:24:52 +0800 Subject: [PATCH] update env variable --- .github/workflows/workflow.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index ee3824a..3638db8 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -18,8 +18,8 @@ jobs: - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '17' - distribution: 'temurin' + java-version: \"17\" + distribution: \"temurin\" cache: maven - name: Set environment variables @@ -60,20 +60,20 @@ jobs: - name: Download JAR from S3 to EC2 run: | - aws ssm send-command --instance-ids ${{ env.INSTANCE_ID }} --document-name "AWS-RunShellScript" --comment "Download JAR from S3" --parameters 'commands=[ + aws ssm send-command --instance-ids ${{ env.INSTANCE_ID }} --document-name "AWS-RunShellScript" --comment "Download JAR from S3" --parameters \"commands=[ "aws s3 cp s3://s3-bucket-safeqr/app-0.0.1-SNAPSHOT.jar /home/ssm-user/app-0.0.1-SNAPSHOT.jar", "ls -l /home/ssm-user/app-0.0.1-SNAPSHOT.jar" - ]' + ]\" - name: Create and Start Systemd Service run: | - aws ssm send-command --instance-ids ${{ env.INSTANCE_ID }} --document-name "AWS-RunShellScript" --comment "Create and start service" --parameters 'commands=[ + aws ssm send-command --instance-ids ${{ env.INSTANCE_ID }} --document-name "AWS-RunShellScript" --comment "Create and start service" --parameters \"commands=[ "aws s3 cp s3://s3-bucket-safeqr/update_env_var.sh /home/ssm-user/update_env_var.sh", "sudo chmod +x /home/ssm-user/update_env_var.sh", "sudo source /home/ssm-user/.bashrc", - "echo -e \"[Unit]\\nDescription=Spring Boot Application\\nAfter=network.target\\n\\n[Service]\\nUser=ssm-user\\nEnvironment='SERVER_DB_URL=${SERVER_DB_URL}' 'SERVER_DB_USERNAME=${SERVER_DB_USERNAME}' 'SERVER_DB_PASSWORD=${SERVER_DB_PASSWORD}' 'SERVER_DB_DRIVER_CLASS_NAME=${SERVER_DB_DRIVER_CLASS_NAME}' 'SERVER_SSL_KEY_STORE_LOCATION=${SERVER_SSL_KEY_STORE_LOCATION}' 'SERVER_SSL_KEY_STORE_PASSWORD=${SERVER_SSL_KEY_STORE_PASSWORD}' 'SERVER_SSL_KEY_ALIAS=${SERVER_SSL_KEY_ALIAS}' 'SERVER_SSL_TRUST_STORE_LOCATION=${SERVER_SSL_TRUST_STORE_LOCATION}' 'SERVER_SSL_TRUST_STORE_PASSWORD=${SERVER_SSL_TRUST_STORE_PASSWORD}' 'SERVER_PORT=${SERVER_PORT}'\\nExecStart=/usr/bin/java -jar /home/ssm-user/app-0.0.1-SNAPSHOT.jar\\nSuccessExitStatus=143\\nRestart=always\\nRestartSec=3\\n\\n[Install]\\nWantedBy=multi-user.target\\n\" | sudo tee /etc/systemd/system/springboot-app.service", + "echo -e \"[Unit]\\nDescription=Spring Boot Application\\nAfter=network.target\\n\\n[Service]\\nUser=ssm-user\\nEnvironment=\"SERVER_DB_URL=${SERVER_DB_URL}\" \"SERVER_DB_USERNAME=${SERVER_DB_USERNAME}\" \"SERVER_DB_PASSWORD=${SERVER_DB_PASSWORD}\" \"SERVER_DB_DRIVER_CLASS_NAME=${SERVER_DB_DRIVER_CLASS_NAME}\" \"SERVER_SSL_KEY_STORE_LOCATION=${SERVER_SSL_KEY_STORE_LOCATION}\" \"SERVER_SSL_KEY_STORE_PASSWORD=${SERVER_SSL_KEY_STORE_PASSWORD}\" \"SERVER_SSL_KEY_ALIAS=${SERVER_SSL_KEY_ALIAS}\" \"SERVER_SSL_TRUST_STORE_LOCATION=${SERVER_SSL_TRUST_STORE_LOCATION}\" \"SERVER_SSL_TRUST_STORE_PASSWORD=${SERVER_SSL_TRUST_STORE_PASSWORD}\" \"SERVER_PORT=${SERVER_PORT}\"\\nExecStart=/usr/bin/java -jar /home/ssm-user/app-0.0.1-SNAPSHOT.jar\\nSuccessExitStatus=143\\nRestart=always\\nRestartSec=3\\n\\n[Install]\\nWantedBy=multi-user.target\\n\" | sudo tee /etc/systemd/system/springboot-app.service", "sudo systemctl daemon-reload", "sudo systemctl enable springboot-app", "sudo systemctl start springboot-app", "sudo systemctl status springboot-app" - ]' + ]\"