name: Build and deploy on: push: branches: [main] workflow_dispatch: permissions: contents: write jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.2' - name: Composer install working-directory: hifi/api run: composer install --no-dev --optimize-autoloader --no-interaction - name: Setup Node uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' cache-dependency-path: hifi-src/package-lock.json - name: npm build working-directory: hifi-src run: | npm ci npm run build - name: Publish build output to deploy branch working-directory: hifi run: | # Sicherheitsnetz: diese Dateien sind umgebungsspezifisch und dürfen # niemals in irgendeinen Branch gelangen, auch nicht versehentlich. rm -f api/config/db.php api/config/setup.php git init -q -b deploy git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add -A git commit -q -m "Deploy build from ${GITHUB_SHA::7}" git push --force "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:deploy env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}