Шифрування файлів та додавання до репозиторію_6_churylov. #135
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: update DAGs airflow | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
update-dags: | |
runs-on: ubuntu-latest | |
# оголошуємо всі змінні | |
env: | |
#глобальні змінні організації | |
SERVER_IP: ${{secrets.SERVER_IP}} | |
SERVER_USER: ${{secrets.SERVER_USER}} | |
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} | |
DECRYPT_PRIVAT_KEY: ${{secrets.DECRYPT_PRIVAT_KEY}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Copy files via SCP | |
run: | | |
echo "${{secrets.SSH_PRIVATE_KEY}}" > key.pem | |
echo "${{secrets.DECRYPT_PRIVAT_KEY}}" > private_key.pem | |
chmod 600 key.pem | |
chmod 600 private_key.pem | |
mkdir -p $HOME/.ssh && ssh-keyscan -H $SERVER_IP >> $HOME/.ssh/known_hosts | |
sudo apt-get update && sudo apt-get install -y openssl | |
openssl rsa -in private_key.pem -check | |
# Розшифровуємо всі архіви в папці encrypted_file | |
for archive in encrypted_file/*.tar.gz; do | |
echo "Decrypting $archive..." | |
./decrypt_and_extract.sh "$archive" private_key.pem | |
done | |
rsync -rav -e "ssh -i key.pem" --delete-after --exclude "key.pem" --exclude "private_key.pem" --exclude "*.tar.gz" ./ $SERVER_USER@$SERVER_IP:/root/airflow-docker/dags | |