Skip to content

Merge pull request #134 from rix-fr/cours/ansible-roles-and-collections #108

Merge pull request #134 from rix-fr/cours/ansible-roles-and-collections

Merge pull request #134 from rix-fr/cours/ansible-roles-and-collections #108

# 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/github-pages-deploy-action@3.7.1
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