feat: base theme for perwez quaregnon trooz #28
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: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '.github/**' | |
- '[template]/**' | |
- 'base/**' | |
- 'basev2/**' | |
- '/*' | |
jobs: | |
get-changed-directories: | |
runs-on: | |
group: self-hosted | |
outputs: | |
changed-directories: ${{ steps.set-output.outputs.changed-directories }} | |
steps: | |
- name: Install Git & jq | |
run: sudo apt-get update && sudo apt-get install -y git jq | |
- name: Install Node.js | |
if: ${{ env.ACT }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y curl | |
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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: | | |
changed_dirs=$(printf "%s" "${{ steps.changed-directories.outputs.all_changed_files }}" | jq -R -s -c 'split(" ")') | |
echo "changed-directories=$changed_dirs" >> "$GITHUB_OUTPUT" | |
- name: Summary | |
run: | | |
echo "Changed directories: ${{ steps.changed-directories.outputs.all_changed_files }}" | |
build-push: | |
environment: build-push | |
needs: get-changed-directories | |
runs-on: | |
group: self-hosted | |
strategy: | |
matrix: | |
directory: ${{ fromJson(needs.get-changed-directories.outputs.changed-directories) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y curl | |
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 8 | |
- name: Install node dev dependencies | |
run: | | |
pnpm install | |
- name: Build themes | |
run: | | |
echo Building theme for ${{ matrix.directory }} | |
pnpm --theme=${{ matrix.directory }} build | |
- name: Install upload dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install -y python3-pip jq | |
pip3 install requests && pip3 install bs4 | |
- name: Upload themes | |
if: ${{ !env.ACT }} # do not run locally | |
run: | | |
python3 theme_uploader.py $(jq -r '.homepage' ${{ matrix.directory }}/package.json) ${{ secrets.PLONE_USER }} ${{ secrets.PLONE_PASSWORD }} ${{ matrix.directory }} | |
- name: Get vhost | |
run: | | |
vhost=$(echo $(jq -r '.homepage' ${{ matrix.directory }}/package.json) | cut -c 9-) | |
echo "vhost=$vhost" >> $GITHUB_ENV | |
- name: Purge cache | |
if: ${{ !env.ACT }} # do not run locally | |
uses: IMIO/gha/[email protected] | |
with: | |
RUNDECK_URL: ${{ secrets.RUNDECK_URL }} | |
RUNDECK_TOKEN: ${{ secrets.SMARTWEB_RUNDECK_TOKEN }} | |
RUNDECK_JOB_ID: ${{ vars.RUNDECK_JOB_ID }} | |
RUNDECK_PARAMETERS: -F "option.vhost=${{ env.vhost }}" | |
MATTERMOST_WEBHOOK_URL: ${{ secrets.SMARTWEB_MATTERMOST_WEBHOOK_URL }} |