-
Notifications
You must be signed in to change notification settings - Fork 2
63 lines (54 loc) · 1.91 KB
/
s.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: S3 and Drive CI/CD Pipeline
on:
push:
branches:
- feat/drive-to-s3
jobs:
run-pipeline:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Print AWS Key (for debugging only)
run: echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}"
- name: Install AWS CLI, unzip, wget, and gdown
run: |
sudo apt-get update
sudo apt-get install awscli unzip wget
pip install gdown
- name: Configure AWS credentials manually
run: |
aws configure set aws_access_key_id "${{ secrets.AWS_ACCESS_KEY_ID }}"
aws configure set aws_secret_access_key "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
aws configure set region ap-south-1
- name: Rename folder in S3 to backup
run: |
aws s3 mv s3://isac-nitkkr-public/isaac-s3-images/ s3://isac-nitkkr-public/isaac-s3-images-bkp/ --recursive
env:
AWS_REGION: ap-south-1
- name: Download File from Google Drive using gdown
run: |
gdown --id 1YLdE1YjT1qSU8ank-ZVhYs5cl0jQohS8 -O /tmp/file.zip
- name: Verify File Download
run: |
file /tmp/file.zip
ls -l /tmp/
- name: Unzip downloaded file
run: |
if file /tmp/file.zip | grep -q 'Zip archive data'; then
unzip /tmp/file.zip -d /tmp/unzipped_files
else
echo "File is not a ZIP archive"
exit 1
fi
- name: Upload unzipped files to S3
run: |
aws s3 cp /tmp/unzipped_files/ s3://isac-nitkkr-public/isaac-s3-images/ --recursive
env:
AWS_REGION: ap-south-1
- name: Delete backup folder from S3 if all tasks pass
if: ${{ success() }}
run: |
aws s3 rm s3://isac-nitkkr-public/isaac-s3-images-bkp/ --recursive
env:
AWS_REGION: ap-south-1