Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cover to last articles and tutorials #1084

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
BASE_URL=/
LOCO_API_KEY=loco-api-key
ALGOLIA_APP_ID=algolia-app-id
ALGOLIA_INDEX=index
ALGOLIA_API_INDEXING_KEY=algolia-api-indexing-key

VITE_IS_DEBUG=true
VITE_HOST_URL=http://localhost:5173
VITE_ALGOLIA_APP_ID=algolia-app-id
VITE_ALGOLIA_INDEX=algolia-index
VITE_ALGOLIA_API_KEY=algolia-api-key
Expand Down
14 changes: 14 additions & 0 deletions .github/actions/restore-npm-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: restore-npm-cache
description: Restore NPM Cache
runs:
using: composite
steps:
- name: Restore NPM Cache
uses: actions/cache@v3
with:
path: "**/node_modules"
key: cache-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: cache-node-modules-npm run
- name: Prepare project
shell: bash
run: npm run prepare
99 changes: 99 additions & 0 deletions .github/workflows/checks-and-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Run checks and tests

on: workflow_call

jobs:
validate-markdown:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Restore NPM Cache
uses: ./.github/actions/restore-npm-cache

- name: Validate markdown authors and posts
id: validate_markdown
run: npm run validate-markdown --ci

- name: Add a comment to the PR after failed markdown validation
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request' && failure()
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
header: validate-markdown
message: |
#### Markdown invalid 🖌

The markdown of the file **${{ steps.validate_markdown.outputs.filePath }}** is invalid !
> ${{ steps.validate_markdown.outputs.reason }}

- name: Remove a comment to the PR after success markdown validation
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request' && success()
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
header: validate-markdown
delete: true

eslint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Restore NPM Cache
uses: ./.github/actions/restore-npm-cache

- name: Lint code
run: npm run lint:es

compile:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Restore NPM Cache
uses: ./.github/actions/restore-npm-cache

- name: Run Compile TypeScript
run: npx tsc

test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Restore NPM Cache
uses: ./.github/actions/restore-npm-cache

- name: Run Tests
run: npm run test

build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Restore NPM Cache
uses: ./.github/actions/restore-npm-cache

- name: Build Application
run: npm run build

build-storybook:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Restore NPM Cache
uses: ./.github/actions/restore-npm-cache

- name: Build Storybook
run: npm run build:storybook
31 changes: 31 additions & 0 deletions .github/workflows/continuous-integration-and-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Continuous Integration

on:
push:
branches:
- master
pull_request:

jobs:
setup:
uses: ./.github/workflows/setup-nodejs-and-install-dependencies.yml
checks-and-tests:
needs: setup
uses: ./.github/workflows/checks-and-tests.yml
deploy:
needs: checks-and-tests
uses: ./.github/workflows/deploy.yml
with:
AWS_REGION: ${{ vars.AWS_REGION }}
AWS_BUCKET_NAME: ${{ vars.AWS_BUCKET_NAME }}
ALGOLIA_INDEX: ${{ vars.ALGOLIA_INDEX }}
GTM_ID: ${{ vars.GTM_ID_DEV }}
IS_DEBUG: ${{ vars.IS_DEBUG }}
secrets:
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_INDEXING_KEY: ${{ secrets.ALGOLIA_API_INDEXING_KEY }}
ALGOLIA_API_SEARCH_KEY: ${{ secrets.ALGOLIA_API_SEARCH_KEY }}
34 changes: 0 additions & 34 deletions .github/workflows/deploy-storybook.yml

This file was deleted.

123 changes: 49 additions & 74 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,101 +1,76 @@
name: Deploy

on:
push:
branches:
- master
pull_request:
workflow_call:
inputs:
AWS_REGION:
required: true
type: string
AWS_BUCKET_NAME:
required: true
type: string
ALGOLIA_INDEX:
required: true
type: string
GTM_ID:
required: true
type: string
IS_DEBUG:
required: true
type: string
secrets:
AWS_ROLE_TO_ASSUME:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
AWS_CLOUDFRONT_DISTRIBUTION_ID:
required: true
ALGOLIA_APP_ID:
required: true
ALGOLIA_API_INDEXING_KEY:
required: true
ALGOLIA_API_SEARCH_KEY:
required: true

jobs:
deploy:
deploy-website:
runs-on: ubuntu-latest
permissions: write-all
environment: ${{ github.ref_name == 'master' && 'production' || github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout Repository
uses: actions/checkout@v4

- name: Restore NPM Cache
uses: ./.github/actions/restore-npm-cache

- name: Sets env vars for dev
if: github.event_name == 'pull_request'
run: |
echo "ENV=${{ github.head_ref }}" >> $GITHUB_ENV
echo "ENV_URL=https://${{ vars.AWS_BUCKET_NAME }}/${{ github.head_ref }}" >> $GITHUB_ENV
echo "ENV_URL=https://${{ inputs.AWS_BUCKET_NAME }}/${{ github.head_ref }}" >> $GITHUB_ENV
echo "BASE_URL=/${{ github.head_ref }}/" >> $GITHUB_ENV

- name: Sets env vars for production
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: |
echo "ENV=production" >> $GITHUB_ENV
echo "ENV_URL=https://${{ vars.AWS_BUCKET_NAME }}" >> $GITHUB_ENV
echo "ENV_URL=https://${{ inputs.AWS_BUCKET_NAME }}" >> $GITHUB_ENV
echo "BASE_URL=/" >> $GITHUB_ENV

- name: Setup node
uses: actions/setup-node@v3
with:
bundler-cache: true
node-version: 20

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "yarnCacheDir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.yarnCacheDir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install modules
run: yarn install --frozen-lockfile

- name: Validate markdown authors and posts
id: validate_markdown
run: yarn validate-markdown --ci

- name: Add a comment to the PR after failed markdown validation
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request' && failure()
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
header: validate-markdown
message: |
#### Markdown invalid 🖌

The markdown of the file **${{ steps.validate_markdown.outputs.filePath }}** is invalid !
> ${{ steps.validate_markdown.outputs.reason }}

- name: Remove a comment to the PR after success markdown validation
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request' && success()
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
header: validate-markdown
delete: true

- name: Run ESLint
run: yarn lint:es

- name: Run Stylelint
run: yarn lint:style

- name: Run Compile TypeScript
run: yarn tsc

- name: Run Test
run: yarn test

- name: Build
run: yarn prerender
run: npm run prerender
env:
NODE_ENV: production
BASE_URL: ${{ env.BASE_URL }}
VITE_HOST_URL: ${{ env.ENV_URL }}
VITE_ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
VITE_ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_SEARCH_KEY }}
VITE_ALGOLIA_INDEX: ${{ vars.ALGOLIA_INDEX }}
VITE_GTM_ID: ${{ vars.GTM_ID }}
VITE_ALGOLIA_INDEX: ${{ inputs.ALGOLIA_INDEX }}
VITE_GTM_ID: ${{ inputs.GTM_ID }}
VITE_IS_DEBUG: ${{ inputs.IS_DEBUG }}

- name: Install aws cli
id: install-aws-cli
Expand All @@ -105,7 +80,7 @@ jobs:
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ vars.AWS_REGION }}
aws-region: ${{ inputs.AWS_REGION }}

- name: Start deployment
uses: bobheadxi/deployments@v1
Expand All @@ -117,17 +92,17 @@ jobs:
env: ${{ env.ENV }}

- name: Deploy to S3
run: aws s3 sync "dist/public/" "s3://${{ vars.AWS_BUCKET_NAME }}${{ env.BASE_URL }}" --delete
run: aws s3 sync "dist/public/" "s3://${{ inputs.AWS_BUCKET_NAME }}${{ env.BASE_URL }}" --delete

- name: Clear caches
run: aws cloudfront create-invalidation --distribution-id "${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}" --paths "${{ env.BASE_URL }}*"

- name: Indexing on Algolia
run: yarn indexation:algolia
run: npm run indexation:algolia
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_INDEXING_KEY: ${{ secrets.ALGOLIA_API_INDEXING_KEY }}
ALGOLIA_INDEX: ${{ vars.ALGOLIA_INDEX }}
ALGOLIA_INDEX: ${{ inputs.ALGOLIA_INDEX }}

- name: Update deployment status
uses: bobheadxi/deployments@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PR Closed

on:
pull_request_target:
types: [closed]
types: [ closed ]

jobs:
pr-closed:
Expand Down
Loading