Skip to content

Commit 9f71adf

Browse files
henmohrwarp-agent
andcommitted
feat: add PR preview deployment workflow
Co-Authored-By: Warp <agent@warp.dev>
1 parent 7aafdb4 commit 9f71adf

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy PR previews
2+
3+
on: pull_request
4+
5+
concurrency: preview-${{ github.ref }}
6+
7+
jobs:
8+
deploy-preview:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Setup Node
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: 20
16+
- name: Set up php 8.4
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: 8.4
20+
- name: Set up PHP dependencie
21+
run: composer i
22+
- name: Change config.php
23+
run: |
24+
sed -i "s|librecode.coop|librecode.github.io|g" CNAME
25+
sed -i "s|'baseUrl' => '/'|'baseUrl' => 'https://LibreCodeCoop.github.io/site-preview/pr-preview/pr-${{ github.event.pull_request.number }}/'|g" config.php
26+
cat config.php|grep "'baseUrl' => "
27+
sed -i "/'matomo_container'/d" config.production.php
28+
- name: Run composer command
29+
run: composer prod
30+
31+
- name: Deploy preview
32+
uses: rossjrw/pr-preview-action@v1
33+
with:
34+
source-dir: ./build_production/
35+
pages-base-url: librecode.github.io/site-preview
36+
deploy-repository: LibreCodeCoop/site-preview
37+
preview-branch: main
38+
token: ${{ secrets.PREVIEW_TOKEN }}

0 commit comments

Comments
 (0)