Skip to content

adjust polaroid stacking #138

adjust polaroid stacking

adjust polaroid stacking #138

Workflow file for this run

name: "Build and Copy Apps"
permissions:
contents: write
on:
push:
branches:
- main
paths:
- 'src/**'
- '.github/workflows/build.yml'
pull_request:
branches:
- main
paths:
- 'src/**'
- '.github/workflows/build.yml'
jobs:
filter-paths:
# This job is the the entrypoint for SPA apps. Here will be detected how much and which build-app jobs needed to be executed.
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
landingpage: ${{ steps.filter.outputs.landingpage }}
photo-booth: ${{ steps.filter.outputs.photo-booth }}
portfolio-agent: ${{ steps.filter.outputs.portfolio-agent }}
videowall: ${{ steps.filter.outputs.videowall }}
changed_apps: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
#define the filters for each app here. The key has to match the src-folder.
filters: |
landingpage:
- '.github/workflows/build.yml'
- 'src/common/**'
- 'src/landingpage/**'
photo-booth:
- '.github/workflows/build.yml'
- 'src/common/**'
- 'src/photo-booth/**'
portfolio-agent:
- '.github/workflows/build.yml'
- 'src/common/**'
- 'src/portfolio-agent/**'
videowall:
- '.github/workflows/build.yml'
- 'src/common/**'
- 'src/videowall/**'
build-app:
# This job will build the specific app(s). Will be called as matrix for all apps with changes detected. The build artifacts are stores names by dist-[appName].
needs: filter-paths
runs-on: ubuntu-latest
outputs:
changed_apps: ${{ needs.filter-paths.outputs.changed_apps }}
strategy:
matrix:
app: ${{ fromJson(needs.filter-paths.outputs.changed_apps) }}
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: src/${{ matrix.app }}/package-lock.json
- name: Install dependencies
working-directory: src/${{ matrix.app }}
run: npm ci
- name: Build app
working-directory: src/${{ matrix.app }}
run: npm run build
# Need to move now from ./{app} folder into a ./artifact-upload/{app} folder, otherwise the app folder will not be included in the artifact upload and causes issues when downloading and merging later.
- name: Move dist package to "artifact-upload" folder for proper artifact handling.
shell: bash
run: |
rm -rf ./artifact-upload
mkdir artifact-upload
mv ${{ matrix.app }} ./artifact-upload/${{ matrix.app }}
# Create the artifact for later job "push-apps".
- name: Upload dist artifact
uses: actions/upload-artifact@v7
with:
name: dist-${{ matrix.app }}
path: ./artifact-upload
push-apps:
# This job will download the artifacts from one or more build-app runs and commits and pushes the changes to the repo.
needs: build-app
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v6
# Each artifact contains the ./{app} folder within the archive. We can unzip in root folder and enable merge-ultiple here, to get the apps unzipped in right spot.
- name: Download all app dist artifacts
uses: actions/download-artifact@v8
with:
merge-multiple: true
- name: Commit build artifacts
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add ${{ join(fromJson(needs.build-app.outputs.changed_apps), ' ') }}
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "Build Pipeline - Update artifacts for: ${{ join(fromJson(needs.build-app.outputs.changed_apps), ', ') }}"
git push
fi