Skip to content

Gentoo launch livecd, chroot and network #1384

Gentoo launch livecd, chroot and network

Gentoo launch livecd, chroot and network #1384

Workflow file for this run

name: Deploy
on:
push:
branches:
- master
pull_request:
env:
AWS_DEFAULT_REGION: eu-west-2
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Sets env vars for dev
if: github.event_name == 'pull_request'
run: |
echo "ENV=dev-${{ github.head_ref }}" >> $GITHUB_ENV
echo "ENV_URL=http://dev.blog.eleven-labs.com.s3-website.${{ env.AWS_DEFAULT_REGION }}.amazonaws.com/${{ github.head_ref }}" >> $GITHUB_ENV
echo "BASE_URL=/${{ github.head_ref }}/" >> $GITHUB_ENV
echo "ALGOLIA_APP_ID=${{ secrets.ALGOLIA_APP_ID }}" >> $GITHUB_ENV
echo "ALGOLIA_INDEX=${{ secrets.ALGOLIA_INDEX_DEV }}" >> $GITHUB_ENV
echo "ALGOLIA_API_INDEXING_KEY=${{ secrets.ALGOLIA_API_INDEXING_KEY_DEV }}" >> $GITHUB_ENV
echo "ALGOLIA_API_SEARCH_KEY=${{ secrets.ALGOLIA_API_SEARCH_KEY_DEV }}" >> $GITHUB_ENV
echo "GTM_ID=${{ secrets.GTM_ID_DEV }}" >> $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://blog.eleven-labs.com" >> $GITHUB_ENV
echo "BASE_URL=/" >> $GITHUB_ENV
echo "ALGOLIA_APP_ID=${{ secrets.ALGOLIA_APP_ID }}" >> $GITHUB_ENV
echo "ALGOLIA_INDEX=${{ secrets.ALGOLIA_INDEX_PRODUCTION }}" >> $GITHUB_ENV
echo "ALGOLIA_API_INDEXING_KEY=${{ secrets.ALGOLIA_API_INDEXING_KEY_PRODUCTION }}" >> $GITHUB_ENV
echo "ALGOLIA_API_SEARCH_KEY=${{ secrets.ALGOLIA_API_SEARCH_KEY_PRODUCTION }}" >> $GITHUB_ENV
echo "GTM_ID=${{ secrets.GTM_ID_PRODUCTION }}" >> $GITHUB_ENV
echo "GOOGLE_SITE_VERIFICATION==${{ secrets.GOOGLE_SITE_VERIFICATION }}" >> $GITHUB_ENV
- name: Setup node
uses: actions/setup-node@v3
with:
bundler-cache: true
node-version: 16
- 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
env:
NODE_ENV: production
BASE_URL: ${{ env.BASE_URL }}
VITE_ALGOLIA_APP_ID: ${{ env.ALGOLIA_APP_ID }}
VITE_ALGOLIA_API_KEY: ${{ env.ALGOLIA_API_SEARCH_KEY }}
VITE_ALGOLIA_INDEX: ${{ env.ALGOLIA_INDEX }}
VITE_GTM_ID: ${{ env.GTM_ID }}
- name: Setup aws
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Start deployment
uses: bobheadxi/deployments@v1
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref }}
env: ${{ env.ENV }}
- name: Deploy to S3 for dev
if: github.event_name == 'pull_request'
run: aws s3 sync "dist/public/" "s3://dev.blog.eleven-labs.com/${{ github.head_ref }}/" --delete
- name: Deploy to S3 for production
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: aws s3 sync "dist/public/" "s3://blog.eleven-labs.com/" --delete
- name: Clear caches
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: |
aws configure set preview.cloudfront true
aws cloudfront create-invalidation --distribution-id "${{ secrets.CLOUDFRONT_DISTRIBUTION }}" --paths "/*"
- name: Indexing on Algolia
run: yarn indexation:algolia
env:
ALGOLIA_APP_ID: ${{ env.ALGOLIA_APP_ID }}
ALGOLIA_API_INDEXING_KEY: ${{ env.ALGOLIA_API_INDEXING_KEY }}
ALGOLIA_INDEX: ${{ env.ALGOLIA_INDEX }}
- name: Update deployment status
uses: bobheadxi/deployments@v1
if: success()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
env: ${{ steps.deployment.outputs.env }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: ${{ env.ENV_URL }}/
- name: Audit URLs using Lighthouse
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@v9
with:
urls: |
${{ env.ENV_URL }}/
${{ env.ENV_URL }}/fr/authors/ajacquemin/
${{ env.ENV_URL }}/fr/comment-construire-site-web-avec-nextjs/
${{ env.ENV_URL }}/fr/nestjs-le-cycle-de-vie-dune-requete/
configPath: ./.github/workflows/lighthousesrc.json
uploadArtifacts: true
temporaryPublicStorage: true
runs: 3
- name: Format lighthouse score
id: format_lighthouse_score
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
script: |
const lighthouseCommentMaker = require('./.github/workflows/lighthouseCommentMaker.cjs');
const lighthouseOutputs = {
manifest: ${{ steps.lighthouse_audit.outputs.manifest }},
links: ${{ steps.lighthouse_audit.outputs.links }},
assertionResults: ${{ steps.lighthouse_audit.outputs.assertionResults }}
};
const comment = lighthouseCommentMaker({ lighthouseOutputs });
core.setOutput("comment", comment);
- name: Add Lighthouse stats as comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
header: lighthouse
message: ${{ steps.format_lighthouse_score.outputs.comment }}