Skip to content

Add contact information page #76

Add contact information page

Add contact information page #76

Workflow file for this run

name: Build and Deploy Preview
on:
pull_request:
branches: [ master, upcoming ]
jobs:
build:
runs-on: ubuntu-latest
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://hydephp.github.io/previews/hydephp-com/${{ github.event.pull_request.number }}" >> .env
echo "TORCHLIGHT_TOKEN=${{ secrets.TORCHLIGHT_TOKEN }}" >> .env
echo "ROBOTS_NOINDEX=true" >> .env
- 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" />' > docs/docs/index.html
- name: Upload site artifact
uses: actions/upload-artifact@v3
with:
name: site
path: docs
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: pull-request-preview
url: https://hydephp.github.io/previews/hydephp-com/${{ github.event.pull_request.number }}
steps:
- name: Download the artifact
uses: actions/download-artifact@v3
with:
name: "site"
path: docs
- name: Upload files to GitHub Pages
uses: cpina/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source-directory: "docs"
destination-github-username: "hydephp"
destination-repository-name: "previews"
target-branch: master
target-directory: "docs/hydephp-com/${{ github.event.pull_request.number }}"
- name: Output the URL
run: echo "https://hydephp.github.io/previews/hydephp-com/${{ github.event.pull_request.number }}"
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://hydephp.github.io/previews/hydephp-com/${{ github.event.pull_request.number }}) is being deployed!<br><br>Please note that it may take a few seconds for GitHub Pages to build and deploy. The preview will be removed at midnight UTC.'
})