Turn off Torchlight line numbers globally #181
Workflow file for this run
This file contains 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: Build and Deploy Preview | |
on: | |
pull_request: | |
branches: [ master, upcoming ] | |
jobs: | |
build-and-deploy-preview: | |
runs-on: ubuntu-latest | |
environment: | |
name: pull-request-preview | |
url: https://ci.hydephp.com/previews/website/${{ github.event.pull_request.number }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Create dotenv | |
run: | | |
echo 'SITE_NAME="HydePHP.com PR Preview"' > .env | |
echo "SITE_URL=https://ci.hydephp.com/previews/website/${{ github.event.pull_request.number }}" >> .env | |
echo "TORCHLIGHT_TOKEN=${{ secrets.TORCHLIGHT_TOKEN }}" >> .env | |
echo "ROBOTS_NOINDEX=true" >> .env | |
- name: Update config | |
run: | | |
echo output_directory: _site > hyde.yml | |
- name: Install composer dependencies | |
run: composer install | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install Node dependencies | |
run: npm install | |
- name: Build frontend assets | |
run: npm run prod | |
- name: Output debug information | |
run: | | |
php hyde --version | |
php hyde debug | |
- name: Run the Hyde Builder | |
run: php hyde build --pretty-urls --no-interaction | |
- name: Create docs redirect | |
run: echo '<meta http-equiv="refresh" content="0;url=/docs/1.x" />' > _site/docs/index.html | |
- name: Package the static site | |
run: zip -r site.zip _site | |
- name: Sign the artifact | |
run: | | |
echo '${{ secrets.CI_PREVIEW_SIGNING_RSA_PRIVATE_KEY }}' > private.pem | |
openssl dgst -sha256 -sign private.pem -out signature.bin site.zip | |
unlink private.pem | |
- name: Upload the artifact | |
run: | | |
repository="website" | |
bearerToken="${{ secrets.CI_SERVER_TOKEN }}" | |
pullRequest="${{ github.event.pull_request.number }}" | |
signature="$(openssl base64 -in signature.bin)" | |
artifact="site.zip" | |
curl -X POST --fail-with-body \ | |
-H "Content-Type: multipart/form-data" \ | |
-H "Authorization: Bearer $bearerToken" \ | |
-F "repository=$repository" \ | |
-F "pullRequest=$pullRequest" \ | |
-F "artifact=@$artifact" \ | |
-F "signature=$signature" \ | |
https://ci.hydephp.com/api/deployment-previews | |
comment-on-pull-request: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
# Only run if a comment was not already made | |
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' && !contains(github.event.pull_request.body, 'A [live preview]') }} | |
steps: | |
- uses: actions/github-script@v5 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'A [live preview](https://ci.hydephp.com/previews/website/${{ github.event.pull_request.number }}) is being deployed!<br><br>Please note that it may take a few seconds the site to be available. Old previews are removed routinely.' | |
}) |