1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-23 01:29:41 +01:00
portfolio/.github/workflows/ci.yml

107 lines
2.9 KiB
YAML
Raw Normal View History

2019-11-26 01:05:58 +01:00
name: 'CI/CD Pipeline'
2019-11-13 18:43:58 +01:00
2019-12-07 15:16:07 +01:00
on:
push:
branches:
2021-01-30 19:20:15 +01:00
- main
2019-12-07 15:16:07 +01:00
pull_request:
branches:
- '**'
2019-11-13 18:43:58 +01:00
jobs:
2019-11-14 01:22:14 +01:00
test:
2019-11-13 18:43:58 +01:00
runs-on: ubuntu-latest
2019-11-26 01:05:58 +01:00
steps:
2022-11-19 08:57:41 +01:00
- uses: actions/checkout@v3
2019-11-26 01:05:58 +01:00
2019-11-26 01:20:37 +01:00
- name: Setup Node.js
2022-11-19 08:57:41 +01:00
uses: actions/setup-node@v3
2019-11-26 01:05:58 +01:00
with:
2022-11-19 08:57:41 +01:00
node-version: '18'
2019-11-26 01:05:58 +01:00
- name: Cache node_modules
uses: actions/cache@v3
2019-11-26 01:05:58 +01:00
with:
path: ~/.npm
2019-11-26 01:20:37 +01:00
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
2019-11-26 01:05:58 +01:00
- run: npm ci
2021-02-06 13:45:47 +01:00
- run: npm test
2022-11-17 19:39:04 +01:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXT_PUBLIC_TYPEKIT_ID: ${{ secrets.NEXT_PUBLIC_TYPEKIT_ID }}
NEXT_PUBLIC_UMAMI_SCRIPT_URL: ${{ secrets.NEXT_PUBLIC_UMAMI_SCRIPT_URL }}
NEXT_PUBLIC_UMAMI_WEBSITE_ID: ${{ secrets.NEXT_PUBLIC_UMAMI_WEBSITE_ID }}
2019-11-26 02:18:54 +01:00
- uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage/
coverage:
runs-on: ubuntu-latest
needs: [test]
if: ${{ success() && github.actor != 'dependabot[bot]' }}
steps:
2022-11-19 08:57:41 +01:00
- uses: actions/checkout@v3
- uses: actions/download-artifact@v2
with:
name: coverage
- uses: paambaati/codeclimate-action@v2.7.5
2019-11-26 02:18:54 +01:00
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
2019-11-26 01:05:58 +01:00
build:
runs-on: ubuntu-latest
2019-11-13 18:43:58 +01:00
steps:
2022-11-19 08:57:41 +01:00
- uses: actions/checkout@v3
2019-11-18 23:02:57 +01:00
2019-11-26 01:20:37 +01:00
- name: Setup Node.js
2022-11-19 08:57:41 +01:00
uses: actions/setup-node@v3
2019-11-13 18:53:31 +01:00
with:
2022-11-19 08:57:41 +01:00
node-version: '18'
2019-11-13 18:53:31 +01:00
- name: Cache node_modules & Next.js build output
uses: actions/cache@v3
2019-11-13 18:53:31 +01:00
with:
path: |
~/.npm
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
2019-11-13 18:53:31 +01:00
2019-11-18 23:02:57 +01:00
- run: npm ci
- run: npm run build
2019-11-13 18:53:31 +01:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXT_PUBLIC_TYPEKIT_ID: ${{ secrets.NEXT_PUBLIC_TYPEKIT_ID }}
2022-11-17 19:06:48 +01:00
NEXT_PUBLIC_UMAMI_SCRIPT_URL: ${{ secrets.NEXT_PUBLIC_UMAMI_SCRIPT_URL }}
NEXT_PUBLIC_UMAMI_WEBSITE_ID: ${{ secrets.NEXT_PUBLIC_UMAMI_WEBSITE_ID }}
# - uses: actions/upload-artifact@v1
# if: github.ref == 'refs/heads/main'
# with:
# name: public
# path: public
# deploy:
# needs: build
# if: success() && github.ref == 'refs/heads/main'
# runs-on: ubuntu-latest
# steps:
2022-11-19 08:57:41 +01:00
# - uses: actions/checkout@v3
# - uses: actions/download-artifact@v1
# with:
# name: public
# - name: Deploy to S3
# run: npm run deploy:s3
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}