forked from swccgpc/holotable
-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (156 loc) · 6.6 KB
/
deploy-cards.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
---
name: Deploy Cards
on:
push:
branches:
- master
paths:
- 'Images-HT/starwars/**'
- 'Images-HT/*.gif'
- 'darkside.cdf'
- 'lightside.cdf'
- '.github/workflows/deploy-cards.yml'
jobs:
dewit:
runs-on: "ubuntu-latest"
steps:
## https://github.com/actions/checkout
## Both actions/checkout@v2 and actions/setup-node@v1 support only up to Node.js v12.
## actions/setup-node@v3 supports Node.js 18
- uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
path: /home/runner/work/holotable/holotable
- name: Checking working directory
run: |
echo
cd /home/runner/work/holotable/holotable
echo "should be in /home/runner/work/holotable/holotable: [$(pwd)]"
echo
echo "/home/runner/work"
find /home/runner/work -maxdepth 1 -mindepth 1 | awk '{print " "$0;}'
echo
echo "/home/runner/work"
ls -al /home/runner/work/ | awk '{print " "$0;}'
echo
echo "/home/runner/work/holotable"
find /home/runner/work/holotable -maxdepth 1 -mindepth 1 | awk '{print " "$0;}'
echo
echo "/home/runner/work/holotable/"
ls -al /home/runner/work/holotable/ | awk '{print " "$0;}'
echo
echo "/home/runner/work/holotable/holotable"
find /home/runner/work/holotable/holotable -maxdepth 1 -mindepth 1 | awk '{print " "$0;}'
echo
echo "/home/runner/work/holotable/holotable/"
ls -al /home/runner/work/holotable/holotable/ | awk '{print " "$0;}'
#echo
#echo "/home/runner/work/holotable/holotable/holotable/"
#find /home/runner/work/holotable/holotable/holotable/ -maxdepth 1 -mindepth 1 | awk '{print " "$0;}'
#echo
#echo "/home/runner/work/holotable/holotable/holotable/"
#ls -al /home/runner/work/holotable/holotable/holotable/ | awk '{print " "$0;}'
- name: Case Fixer
run: |
python3 case_fixer.py
- name: Make gifs
run: |
pip3 install pillow
python3 make_gif_from_pngs.py
sleep 2s
- name: Update listmd5 and create release zip
run: |
bash make_listmd5.sh
python3 fix_bullets.py
sleep 2s
python3 make_version_dat.py
sleep 2s
bash make_release_zip.sh
- name: sync to s3
run: |
echo "Cards"
aws s3 sync ./Images-HT/starwars/ s3://res.starwarsccg.org/cards/ --exclude '.git/*' --exclude '.github/*' --exclude 'node_modules/*' --exclude README.md --exclude package-lock.json --exclude package.json
echo "Legacy"
aws s3 sync ./Images-HT/legacy/ s3://res.starwarsccg.org/cards/legacy/ --exclude '.git/*' --exclude '.github/*' --exclude 'node_modules/*' --exclude README.md --exclude package-lock.json --exclude package.json
echo "Cloudfront Invalidation"
aws cloudfront create-invalidation --distribution-id E4R02360UW5RJ --paths "/cards/" "/cards/*"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Commit files
run: |
git config --global user.email "devon+github-actions[bot]@hubner.org"
git config --global user.name "github-actions[bot]"
#echo '[url "[email protected]:"]' >> ~/.gitconfig
#echo 'insteadOf = https://github.com/' >> ~/.gitconfig
git add -A Images-HT/ ; true
git commit -m "Fixing case and making gifs" -a ; true
#git pull -q ; true
## https://github.com/ad-m/github-push-action
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Commit updates to holotable_exe
run: |
git config --global user.email "devon+github-actions[bot]@hubner.org"
git config --global user.name "github-actions[bot]"
echo
echo
echo "ls"
ls -al
echo
echo "git....: [$(which git)]: $(git --version)"
echo "python3: [$(which python3)]"
echo "rsync..: [$(which rsync)]"
echo
echo "should be in /home/runner/work/holotable/holotable: [$(pwd)]"
cd /home/runner/work/holotable/
echo "should be in /home/runner/work/holotable: [$(pwd)]"
echo
export GIT_SSH_KEY_FILE="/home/runner/work/holotable/swccg-holotable-exe.pem"
echo "${{ secrets.SWCCG_HOLOTABLE_EXE }}" > ${GIT_SSH_KEY_FILE}
chmod 0600 ${GIT_SSH_KEY_FILE}
echo "${GIT_SSH_KEY_FILE} info:"
ls -al ${GIT_SSH_KEY_FILE}
export TIMESTAMP=$(date +'%Y%m%d-%H%M')
echo
echo "Setting GIT_SSH_COMMAND" #/home/runner/work/holotable
export GIT_SSH_COMMAND="ssh -i ${GIT_SSH_KEY_FILE} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
echo "git clone holotable_exe"
git clone [email protected]:swccgpc/holotable_exe.git holotable_exe
echo
echo "ls"
ls -al
echo
ls holotable_exe
echo
echo "copy cdf and image files to holotable_exe"
cd holotable_exe/
echo "should be in /home/runner/work/holotable/holotable_exe: [$(pwd)]"
echo
echo "ls -al .."
echo ls -al .. | awk '{print " "$0;}'
echo
echo "/home/runner/work/holotable/holotable/holotable/Images-HT/starwars"
echo ls -al /home/runner/work/holotable/holotable/Images-HT/starwars | awk '{print " "$0;}'
echo
chmod +x ./update_cards.py
python3 ./update_cards.py
##
## update_cards.py changes the directory to holotable/Images-HT/starwars
## change back to the base level to make the commit
##
cd /home/runner/work/holotable/holotable_exe
git config --global user.email "devon+github-actions[bot]@hubner.org"
git config --global user.name "github-actions[bot]"
git add -A .
git commit -m "${TIMESTAMP}" -a
git tag "${TIMESTAMP}"
git push origin "${TIMESTAMP}"
cd ..
rm swccg-holotable-exe.pem