Update ApiClient.java #99
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 Ubuntu Server | |
on: | |
push: | |
branches: | |
- main # Запускать workflow при push на ветку main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest # Использовать последний доступный образ Ubuntu | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 # Проверить репозиторий на машину сборки | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' # Установить JDK 17 от Temurin | |
java-version: '17' | |
- name: Set environment variables | |
run: | | |
echo "DB_URL=${{ secrets.DB_URL }}" >> $GITHUB_ENV | |
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> $GITHUB_ENV | |
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> $GITHUB_ENV | |
echo "WEATHER_API_KEY=${{ secrets.WEATHER_API_KEY }}" >> $GITHUB_ENV # Установить переменные окружения из секретов GitHub | |
- name: Debug environment variables | |
run: printenv # Вывести все переменные окружения для отладки | |
- name: Build weatherApiService | |
run: mvn -B package --file weatherApiService/pom.xml # Собрать проект Maven, указав путь к pom.xml | |
- name: List built files for weatherApiService | |
run: ls -la weatherApiService/target # Показать список файлов в целевой папке после сборки | |
- name: Deploy weatherApiService to Server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
source: 'weatherApiService/target/weatherApiService-0.0.1-SNAPSHOT.jar' # Указать путь к скомпилированному JAR файлу | |
target: '/home/xyl1gan4eg/myJavaProjects/weatherProject/weatherApiService' # Указать целевой путь на сервере | |
port: 22 | |
timeout: 30s | |
command_timeout: 10m | |
use_insecure_cipher: false | |
rm: false | |
debug: false | |
strip_components: 0 | |
overwrite: true | |
tar_dereference: false | |
tar_exec: tar | |
proxy_port: 22 | |
proxy_timeout: 30s | |
proxy_use_insecure_cipher: false # Настройки для scp-action, чтобы копировать файл на удаленный сервер | |
- name: SSH into server and restart weatherApiService | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
echo "Restarting weatherApiService..." | |
sudo systemctl stop weather-api-service || true | |
sudo cp /home/xyl1gan4eg/myJavaProjects/weatherProject/weatherApiService/weatherApiService-0.0.1-SNAPSHOT.jar /opt/weatherApiService/ | |
sudo systemctl start weather-api-service | |
- name: Build userService | |
run: mvn -B package --file userService/pom.xml # Собрать проект Maven, указав путь к pom.xml | |
- name: List built files for userService | |
run: ls -la userService/target # Показать список файлов в целевой папке после сборки | |
- name: Deploy userService to Server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
source: 'userService/target/userService-0.0.1-SNAPSHOT.jar' # Указать путь к скомпилированному JAR файлу | |
target: '/home/xyl1gan4eg/myJavaProjects/weatherProject/userService' # Указать целевой путь на сервере | |
port: 22 | |
timeout: 30s | |
command_timeout: 10m | |
use_insecure_cipher: false | |
rm: false | |
debug: false | |
strip_components: 0 | |
overwrite: true | |
tar_dereference: false | |
tar_exec: tar | |
proxy_port: 22 | |
proxy_timeout: 30s | |
proxy_use_insecure_cipher: false # Настройки для scp-action, чтобы копировать файл на удаленный сервер | |
- name: SSH into server and restart userService | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
echo "Restarting userService..." | |
sudo systemctl stop user-service || true | |
sudo cp /home/xyl1gan4eg/myJavaProjects/weatherProject/userService/userService-0.0.1-SNAPSHOT.jar /opt/userService/ | |
sudo systemctl start user-service | |
- name: List files on server for debug | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
echo "Listing files in /home/xyl1gan4eg/myJavaProjects/weatherProject/userService/" | |
ls -la /home/xyl1gan4eg/myJavaProjects/weatherProject/userService/ # Показать список файлов в целевой папке для отладки | |
echo "Listing files in /home/xyl1gan4eg/myJavaProjects/weatherProject/weatherApiService/" | |
ls -la /home/xyl1gan4eg/myJavaProjects/weatherProject/weatherApiService/ # Показать список файлов в целевой папке для отладки |