Skip to content

trigger build

trigger build #32

Workflow file for this run

on:
push:
branches: [main]
jobs:
publish:
name: Publish to Cloudflare Pages
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: dorny/paths-filter@v3
id: files_changed
with:
list-files: "shell"
filters: |
deps:
- "package-lock.json"
lib:
- "packages/common/**/*"
sites:
- "sites/**/*"
# helper to extract the sites that were modified
# input_string="/home/sites/my-site/src/index.html"; echo "${input_string#*/sites/}" | cut -d'/' -f1
# run only if some file in 'src' folder was changed
# - if: steps.files_changed.outputs.src == 'true'
# run: ...
- name: Build Matrix
id: sites_matrix
run: |
site_paths=(${{steps.files_changed.outputs.sites_files}})
echo SITE_PATHS="${site_paths[@]}"
sites=()
for i in "${site_paths[@]}";
do
sites_directory="${i#*sites/}"
sites_directory="${sites_directory%%/*}"
sites+=("$sites_directory")
done
unique_sites=$(echo $sites | tr ' ' '\n' | sort | uniq)
echo $unique_sites
echo SITES="${unique_sites}" >> $GITHUB_OUTPUT;
- name: List Changed Files
run: |
echo "Changed lib files: ${{ steps.files_changed.outputs.lib_files }}"
echo "Changed sites files: ${{ steps.files_changed.outputs.sites_files }}"
echo "Sites Matrix: ${{ toJson(steps.sites_matrix.outputs.SITES) }}"
# Run a build step here if your project requires
# - name: Publish to Cloudflare Pages
# uses: cloudflare/pages-action@v1
# with:
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# accountId: YOUR_ACCOUNT_ID
# projectName: YOUR_PROJECT_NAME
# directory: YOUR_BUILD_OUTPUT_DIRECTORY
# # Optional: Enable this if you want to have GitHub Deployments triggered
# gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# # Optional: Switch what branch you are publishing to.
# # By default this will be the branch which triggered this workflow
# branch: main
# # Optional: Change the working directory
# workingDirectory: my-site
# # Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta`
# wranglerVersion: "3"