mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-22 18:00:06 +01:00
92 lines
2.5 KiB
YAML
92 lines
2.5 KiB
YAML
name: 'CI'
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: ${{ runner.os }}-node-
|
|
|
|
- name: Cache Gatsby Cache Folder
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: .cache
|
|
key: ${{ runner.os }}-cache-gatsby
|
|
restore-keys: ${{ runner.os }}-cache-gatsby
|
|
|
|
- name: Cache Gatsby Public Folder
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: public/
|
|
key: ${{ runner.os }}-public-gatsby
|
|
restore-keys: ${{ runner.os }}-public-gatsby
|
|
|
|
- run: npm ci
|
|
- run: npm run build
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GATSBY_TYPEKIT_ID: ${{ secrets.GATSBY_TYPEKIT_ID }}
|
|
GATSBY_MAPBOX_ACCESS_TOKEN: ${{ secrets.GATSBY_MAPBOX_ACCESS_TOKEN }}
|
|
GATSBY_UMAMI_SCRIPT_URL: ${{ secrets.GATSBY_UMAMI_SCRIPT_URL }}
|
|
GATSBY_UMAMI_WEBSITE_ID: ${{ secrets.GATSBY_UMAMI_WEBSITE_ID }}
|
|
GATSBY_INFURA_ID: ${{ secrets.GATSBY_INFURA_ID }}
|
|
- run: npm test
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: coverage
|
|
path: coverage/
|
|
|
|
- uses: actions/upload-artifact@v1
|
|
if: github.ref == 'refs/heads/main'
|
|
with:
|
|
name: public
|
|
path: public
|
|
|
|
coverage:
|
|
runs-on: ubuntu-latest
|
|
needs: [test]
|
|
if: ${{ success() && github.actor != 'dependabot[bot]' }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: coverage
|
|
- uses: paambaati/codeclimate-action@v2.7.5
|
|
env:
|
|
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
|
|
|
deploy:
|
|
needs: test
|
|
if: success() && github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- 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 }}
|