fix(preview): pass PR number via artifact #13
This file contains hidden or 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
| name: Preview Build | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| types: [opened, reopened, synchronize] | |
| concurrency: | |
| group: preview-build-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-preview: | |
| runs-on: ubuntu-latest | |
| env: | |
| WC_CONSUMER_KEY: ${{ secrets.WC_CONSUMER_KEY }} | |
| WC_CONSUMER_SECRET: ${{ secrets.WC_CONSUMER_SECRET }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Set up php 8.3 | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.3 | |
| - name: Set up PHP dependencie | |
| run: composer i | |
| - name: Change config.php | |
| run: | | |
| sed -i "s|libresign.coop|libresign.github.io|g" CNAME | |
| sed -i "s|baseUrl' => '/'|baseUrl' => 'https://LibreSign.github.io/site-preview/pr-preview/pr-${{ github.event.pull_request.number }}/'|g" config.php | |
| sed -i "s|base: '/assets/build/'|base: 'https://libresign.github.io/site-preview/pr-preview/pr-${{ github.event.pull_request.number }}/assets/build/'|g" vite.config.js | |
| cat config.php|grep "'baseUrl' => " | |
| sed -i "/'matomo_container'/d" config.production.php | |
| - name: Run composer command | |
| run: composer prod | |
| - name: Save PR number | |
| run: printf '%s\n' '${{ github.event.pull_request.number }}' > preview-pr-number.txt | |
| - name: Upload PR number artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: preview-pr-number | |
| path: preview-pr-number.txt | |
| retention-days: 1 | |
| - name: Upload preview build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: preview-build | |
| path: build_production/ | |
| retention-days: 1 |