Merge branch 'dev' #50
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
name: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
env: | |
NODE_OPTIONS: --max_old_space_size=4096 | |
NODE_VERSION: 18.16.0 | |
PNPM_VERSION: 8.6.1 | |
concurrency: | |
# Prevent parallel builds of the same branch | |
group: cicd-${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
requirements: | |
name: Continuous Integration | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: ${{ env.PNPM_VERSION }} | |
run_install: false | |
- name: Export pnpm store directory as an environment variable | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: make deps | |
- name: Lint | |
run: make lint | |
- name: Format check | |
run: make format-check | |
- name: Test unit | |
run: make test-unit | |
- uses: actions/cache@v3 | |
name: Setup assets cache | |
with: | |
path: apps/docs/tmp/ | |
# The `raw` DSFR is scrapped with a fixed URL so you have to delete the CI/CD cache if you want a new version of it | |
key: ${{ runner.os }}-assets-${{ hashFiles('apps/docs/scripts/assets.ts') }} | |
restore-keys: | | |
${{ runner.os }}-assets- | |
- name: Prepare building | |
run: make build-prepare | |
- name: Build | |
env: | |
CRISP_WEBSITE_ID: ${{ secrets.CRISP_WEBSITE_ID }} | |
run: make build | |
- name: Deploy to Netlify | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
env: | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
run: make deploy | |
- name: Release package | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
working-directory: packages/dsfr-connect | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: pnpx [email protected] |