-
Notifications
You must be signed in to change notification settings - Fork 159
69 lines (59 loc) · 2.09 KB
/
testnet-watcher.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
65
66
67
68
69
name: Watcher - testnet
on:
push:
branches:
- main
jobs:
changed_files:
runs-on: ubuntu-latest
name: Get changed files
steps:
- uses: actions/checkout@v4
- name: GCP Auth
id: auth
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.TESTNET_GCP_CREDENTIALS }}
- name: Setup GCP SDK
id: setup-sdk
uses: google-github-actions/setup-gcloud@v1
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: testnets/**
files_ignore: testnets/initia/**
- name: Get current time
uses: initia-labs/actions/get-current-time@main
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
- name: Copy changed files to GCS
env:
ALL_ADDED_FILES: ${{ steps.changed-files.outputs.added_files }}
ALL_MODIFIED_FILES: ${{ steps.changed-files.outputs.modified_files }}
ALL_DELETED_FILES: ${{ steps.changed-files.outputs.deleted_files }}
CURRENT_TIME: ${{ steps.current-time.outputs.formattedTime }}
run: |
if [ -n "${ALL_ADDED_FILES}" ]; then
for add in ${ALL_ADDED_FILES}; do
echo "Copying $add to GCS..."
path=$(dirname "$add")
gsutil -m cp "$add" gs://testnet-initia-registry/v1/"$CURRENT_TIME"/added/"$path"/
done
fi
if [ -n "${ALL_MODIFIED_FILES}" ]; then
for mod in ${ALL_MODIFIED_FILES}; do
echo "Copying $mod to GCS..."
path=$(dirname "$mod")
gsutil -m cp "$mod" gs://testnet-initia-registry/v1/"$CURRENT_TIME"/modified/"$path"/
done
fi
if [ -n "${ALL_DELETED_FILES}" ]; then
touch deleted_files
for del in ${ALL_DELETED_FILES}; do
echo "Writing $del to file..."
echo "$del" >> deleted_files
done
gsutil -m cp deleted_files gs://testnet-initia-registry/v1/"$CURRENT_TIME"/deleted/
fi