1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-26 03:06:25 +02:00

add S3 deployment

This commit is contained in:
Matthias Kretschmann 2021-01-30 21:07:49 +01:00
parent 354c1b67a7
commit fc5e273479
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -47,23 +47,42 @@ jobs:
- name: Cache Gatsby Cache Folder
uses: actions/cache@v1
id: gatsby-cache-folder
with:
path: .cache
key: ${{ runner.os }}-cache-gatsby
restore-keys: |
${{ runner.os }}-cache-gatsby
restore-keys: ${{ runner.os }}-cache-gatsby
- name: Cache Gatsby Public Folder
uses: actions/cache@v1
id: gatsby-public-folder
with:
path: public/
key: ${{ runner.os }}-public-gatsby
restore-keys: |
${{ runner.os }}-public-gatsby
restore-keys: ${{ runner.os }}-public-gatsby
- run: npm ci
- run: npm run build
env:
GATSBY_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GATSBY_MAPBOX_ACCESS_TOKEN: ${{ secrets.GATSBY_MAPBOX_ACCESS_TOKEN }}
- 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:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
with:
name: public
- name: Deploy to S3
run: ./scripts/deploy-s3.sh
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}