Skip to content

Build & Deploy

Build & Deploy #1647

Workflow file for this run

name: Build & Deploy
on:
pull_request:
push:
branches:
- master
release:
types: [released]
schedule:
- cron: '0 6 * * *'
jobs:
build:
runs-on: ubuntu-latest
env:
ENV_USER_PASS: ${{ secrets.ENV_USER_PASS }}
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
- name: Setup PHP env 🏗
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
- name: Setup Node.js 🏗
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm 📦
uses: pnpm/action-setup@v3
with:
version: 10
run_install: false
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer Directory 📦
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-
- name: Cache pnpm store 💾
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-${{ runner.os }}-
- name: Install Contributors dependencies 💚
run: pnpm install --frozen-lockfile
- name: Build Contributors Site 👷
run: pnpm run build && pnpm run generate
- name: Install Traces project 💚
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
run: composer create-project prestashop/traces
- name: Fetch repositories 🔧
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
working-directory: ./traces
run: php bin/console traces:fetch:repositories --ghtoken=${ENV_USER_PASS} --config="./config.dist.yml"
- name: Fetch contributors 🔧
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
working-directory: ./traces
run: php bin/console traces:fetch:contributors --ghtoken=${ENV_USER_PASS} --config="./config.dist.yml"
- name: Fetch merged pull requests 🔧
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
working-directory: ./traces
run: php bin/console traces:fetch:pullrequests:merged --ghtoken=${ENV_USER_PASS}
- name: Generate new contributors 🔧
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
working-directory: ./traces
run: php bin/console traces:generate:newcontributors --limitNew=10 --config="./config.dist.yml"
- name: Generate top companies 🔧
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
working-directory: ./traces
run: php bin/console traces:generate:topcompanies --ghtoken=${ENV_USER_PASS} --config="./config.dist.yml"
- name: Display Contributors without Companies 🔎
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
run: cat ./traces/gh_loginsWOCompany.json
- name: Move JSON files 📁
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
run: |
mv ./traces/contributors.json ./dist
mv ./traces/contributors_prs.json ./dist
mv ./traces/topcompanies.json ./dist
mv ./traces/topcompanies_prs.json ./dist
mv ./traces/newcontributors.json ./dist
- name: Write CNAME file 🌐
run: echo 'contributors.prestashop-project.org' > ./dist/CNAME
- name: Deploy 🚀
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
cname: contributors.prestashop-project.org