-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (55 loc) · 1.94 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
64
name: S3 and Drive CI/CD Pipeline
on:
push:
branches:
- feat/drive-to-s3
jobs:
run-pipeline:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v2
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: ap-south-1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-south-1
## the following creates an ARN based on the values entered into github secrets
role-to-assume: arn:aws:iam::471112850772:role/cicd
role-session-name: myGitHubActions
- 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: Install gdown to download from Google Drive
run: |
pip install gdown
- name: Download Google Drive folder
run: |
gdown --folder https://drive.google.com/drive/folders/1YLdE1YjT1qSU8ank-ZVhYs5cl0jQohS8
env:
AWS_REGION: ap-south-1
- name: Unzip downloaded files
run: |
sudo apt-get install unzip
unzip '*.zip' -d /tmp/unzipped-folder/
- name: Upload unzipped folder to S3
run: |
aws s3 cp /tmp/unzipped-folder/ 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