Merge pull request #117 from rix-fr/blog/rex_incident #90
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
# Deploy on GH Pages as staging env | |
name: Deploy staging | |
on: | |
workflow_dispatch: ~ | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
deploy-staging: | |
name: 'π§ Build & deploy π' | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
environment: | |
name: staging | |
url: https://rix-fr.github.io/rix/ | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v2 | |
# https://github.com/actions/setup-node | |
- name: 'Setup node' | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: 'Setup PHP' | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
ini-values: "memory_limit=-1" | |
php-version: "8.1" | |
- name: 'Cache resized images' | |
uses: actions/cache@v2 | |
with: | |
path: public/resized | |
key: resized-images-${{ github.workflow }}-${{ secrets.CACHE_VERSION }} | |
- name: 'Determine composer cache directory' | |
id: composer-cache | |
run: echo "::set-output name=directory::$(composer config cache-dir)" | |
- name: 'Cache composer dependencies' | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.directory }} | |
key: composer-${{ hashFiles('composer.lock') }} | |
- name: 'Cache NPM dependencies' | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: node-${{ hashFiles('package-lock.json') }} | |
- name: 'Install dependencies' | |
run: | | |
echo "::group::composer install" | |
composer install --no-progress --ansi | |
echo "::endgroup::" | |
echo "::group::npm install" | |
npm install --color=always --no-progress | |
echo "::endgroup::" | |
- name: 'Warmup' | |
run: | | |
echo "::group::warmup production env" | |
npx encore production --color | |
bin/console cache:clear --ansi | |
bin/console cache:warmup --ansi | |
echo "::endgroup::" | |
env: | |
APP_ENV: prod | |
WEBPACK_PUBLIC_PATH: /rix/build | |
- name: 'Build static site' | |
run: bin/console stenope:build --no-interaction -vv --ansi --ignore-content-not-found | |
env: | |
APP_ENV: prod | |
APP_FORCE_NO_INDEX: 1 | |
ROUTER_DEFAULT_URI: https://rix-fr.github.io/rix | |
# https://github.com/marketplace/actions/deploy-to-github-pages | |
- name: 'π Deploy' | |
uses: JamesIves/[email protected] | |
with: | |
COMMIT_MESSAGE: "[AUTO] Static site update for ${{ github.sha }}" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages # The branch the action should deploy to. | |
FOLDER: build # The folder the action should deploy. | |
CLEAN: true # Automatically remove deleted files from the deploy branch | |
CLEAN_EXCLUDE: '["pr/"]' # Don't clean the PR deployments |