-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gha): upload modified theme [skip ci]
WEB-4112
- Loading branch information
Showing
1 changed file
with
46 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
name: Build | ||
name: Build and upload themes | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
base-theme: | ||
dependencies: | ||
runs-on: | ||
group: self-hosted | ||
outputs: | ||
changed-directories: ${{ steps.set-output.outputs.changed-directories }} | ||
steps: | ||
- name: Install Git | ||
run: sudo apt-get update && sudo apt-get install -y git | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
|
@@ -21,14 +28,44 @@ jobs: | |
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Install dev dependencies | ||
- name: Install node dev dependencies | ||
run: | | ||
pnpm install | ||
- name: Build theme | ||
- name: Install upload dependencies | ||
run: | | ||
pnpm --theme=base build | ||
- name: Upload theme | ||
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 "changed-directories=${{ steps.changed-directories.outputs.all_changed_files }}" >> "$GITHUB_OUTPUT" | ||
build: | ||
needs: dependencies | ||
runs-on: | ||
group: self-hosted | ||
steps: | ||
- name : echo changed directories | ||
run: echo ${{ needs.dependencies.outputs.changed-directories }} | ||
- 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: | | ||
sudo apt-get update && sudo apt-get install -y python3-pip | ||
pip3 install requests && pip install bs4 | ||
python3 theme_uploader.py ${{ vars.PLONE_URL }} ${{ secrets.PLONE_USER }} ${{ secrets.PLONE_PASSWORD }} | ||
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 |