Skip to content

Create workflow to update community files weekly #186

Create workflow to update community files weekly

Create workflow to update community files weekly #186

Workflow file for this run

name: Build the site
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
build:
environment:
name: production
url: https://hydephp.com
concurrency: production
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_URL=https://hydephp.com/" > .env
- name: Add Torchlight token
run: echo "TORCHLIGHT_TOKEN=${{ secrets.TORCHLIGHT_TOKEN }}" >> .env
- name: Install composer dependencies
run: composer install --prefer-dist
- 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: Download the latest community files
run: php hyde download-community-files
- name: Run the Hyde Builder
run: php hyde build --pretty-urls --run-prettier --no-interaction
- name: Create .nojekyll
run: touch docs/.nojekyll
- name: Create CNAME
run: echo "hydephp.com" > docs/CNAME
- name: Copy favicon to site root
run: cp docs/media/favicon.ico docs/favicon.ico
- name: Create docs redirect
run: echo '<meta http-equiv="refresh" content="0;url=/docs/1.x" />' > docs/docs/index.html
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
add: 'docs'
message: 'Build the site'