Skip to content

Merge pull request #379 from Gergall/master #214

Merge pull request #379 from Gergall/master

Merge pull request #379 from Gergall/master #214

Workflow file for this run

---
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 "git@github.com:"]' >> ~/.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 git@github.com: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