Build and upload themes #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and upload themes | |
on: | |
workflow_dispatch: | |
jobs: | |
dependencies: | |
runs-on: | |
group: self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 8 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install node dev dependencies | |
run: | | |
pnpm install | |
- name: Install upload dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install -y python3-pip jq | |
pip3 install requests && pip3 install bs4 | |
- name: Get changed directories names | |
id: changed-directories | |
uses: tj-actions/[email protected] | |
with: | |
dir_names: 'true' | |
dir_names_exclude_current_dir: 'true' | |
dir_names_max_depth: '1' | |
- name: Set output | |
id: set-output | |
run: echo "::set-output name=changed-directories::${{ steps.changed-directories.outputs.all_changed_files }}" | |
build: | |
needs: dependencies | |
runs-on: | |
group: self-hosted | |
steps: | |
- name: Build themes | |
run: | | |
for directory in ${{ needs.dependencies.outputs.changed-directories }}; do | |
echo Building theme for $directory | |
pnpm --theme=$directory build | |
done | |
upload: | |
needs: build | |
runs-on: | |
group: self-hosted | |
environment: upload | |
steps: | |
- name: Upload themes | |
run: | | |
for directory in ${{ needs.dependencies.outputs.changed-directories }}; do | |
echo python3 theme_uploader.py $(jq -r '.homepage' $directory/package.json) ${{ secrets.PLONE_USER }} ${{ secrets.PLONE_PASSWORD }} | |
done |