[Blog] Accompagnement alternants - Ep 2 (#646) #264
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: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
jobs: | |
deploy-staging: | |
name: 'π§ Build & deploy π' | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
environment: | |
name: staging | |
url: https://elao.github.io/elao_/ | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
# https://github.com/actions/setup-node | |
- name: 'Setup node' | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: 'npm' | |
- name: 'Setup PHP' | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
ini-values: "memory_limit=-1" | |
php-version: "8.3" | |
- name: 'Cache resized images' | |
uses: actions/cache@v4 | |
with: | |
path: public/resized | |
key: resized-images-${{ github.workflow }}-${{ secrets.CACHE_VERSION }} | |
- name: 'Determine composer cache directory' | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: 'Cache composer dependencies' | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- 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 --no-audit --no-fund | |
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: /elao_/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://elao.github.io/elao_ | |
# https://github.com/marketplace/actions/deploy-to-github-pages | |
- name: 'π Deploy' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
commit-message: "[AUTO] Static site update for ${{ github.sha }}" | |
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 | |
# Don't clean the PR deployments nor their resized images | |
clean-exclude: | | |
pr/* | |
resized/* |