Skip to content

Build templates and upload to blob #8

Build templates and upload to blob

Build templates and upload to blob #8

name: Build templates and upload to blob
on:
workflow_dispatch:
# schedule:
# - cron: '9,19,29,39,49,59,59 * * * *'
push:
branches:
- "main"
- "events/lemmy/2023"
paths:
- "templates/*/autopick*.png"
- "templates/*/canvas*.png"
- "templates/*/endu*.png"
- "templates/*/endu_template.json"
- "templates/*/mask*.png"
- "templates/*/template.json"
- "templates/*/version.txt"
- "templates/*/sources/*.png"
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
lfs: true
- name: Python setup for template build
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Build templates
run: |
python3 -m pip install --upgrade pip
if [ -f ./.build/template_assembler/requirements.txt ]; then pip install -r ./.build/template_assembler/requirements.txt; fi
buildTemplates="mlp" # "mlp r-ainbowroad spain"
for buildTemplate in $buildTemplates; do
python3 .build/template_assembler/assemble_template.py templates/$buildTemplate
done
- name: Copy canvas files
run: |
mkdir -p ./dist
copyTemplates="mlp mlp_alliance mlp_world r-ainbowroad spain phoenixmc"
# cp -f ./templates/mlp/autopick.png ./templates/mlp/canvas.png ./templates/mlp/mask.png ./templates/mlp/endu.png ./templates/mlp/endu_template.json ./templates/mlp/version.txt ./dist/mlp
for copyTemplate in $copyTemplates; do
mkdir -p ./dist/$copyTemplate
for copyFile in autopick.png canvas.png mask.png version.txt; do
echo "Checking ./templates/$copyTemplate/$copyFile"
if [[ -f ./templates/$copyTemplate/$copyFile ]]; then
cp -f ./templates/$copyTemplate/$copyFile ./dist/$copyTemplate
fi
done
for copyFile in `ls -1 ./templates/$copyTemplate/endu*`; do
echo "Checking $copyFile"
if [[ -f $copyFile ]]; then
cp -f $copyFile ./dist/$copyTemplate
fi
done
done
- name: Produce build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: |
dist
- name: Setup rclone
uses: AnimMouse/setup-rclone@v1
with:
rclone_config: |
[minio]
type = s3
provider = Minio
env_auth = false
access_key_id = ${{ secrets.RCLONE_CONFIG_MINIO_ACCESS_KEY_ID }}
secret_access_key = ${{ secrets.RCLONE_CONFIG_MINIO_SECRET_ACCESS_KEY }}
endpoint = ${{ secrets.RCLONE_CONFIG_MINIO_ENDPOINT }}
region = us-east-1
disable_base64: true
# creds will expire around 2024-06-16
#- name: Azure login
# uses: azure/login@v1
# with:
# creds: ${{ secrets.PONYPLACE_BLOB_CREDS }}
- name: Upload to blob storage
run: |
rclone -c copy ./dist "minio:cdn"
#- name: Azure logout
# run: az logout
# if: always()