setup gitpod (#30) #129
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Deploy | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [main] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- name: Configure AWS Credentials | |
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: ${{ secrets.AWS_REGION }} | |
- name: Test React App | |
run: npm install && npm run test:ci | |
- name: Setup contentful env variables | |
run: echo CONTENTFUL_PORTFOLIO_ID=${{ secrets.CONTENTFUL_PORTFOLIO_ID }} >> .env && echo CONTENTFUL_BLOG_ID=${{ secrets.CONTENTFUL_BLOG_ID }} >> .env && echo CONTENTFUL_SPACE_ID=${{ secrets.CONTENTFUL_SPACE_ID }} >> .env && echo CONTENTFUL_ACCESS_TOKEN=${{ secrets.CONTENTFUL_ACCESS_TOKEN }} >> .env | |
- name: Setup app env variables | |
run: echo APP_API_BASE_URL=${{ secrets.APP_API_BASE_URL }} >> .env | |
- name: Setup Google Analytics env variables | |
run: echo GA_TRACKING_ID=${{ secrets.GA_TRACKING_ID }} >> .env && echo GA_AD_SENSE_TRACKING_ID=${{ secrets.GA_AD_SENSE_TRACKING_ID }} >> .env | |
- name: Setup Disqus env variables | |
run: echo DISQUS_SHORTNAME=${{ secrets.DISQUS_SHORTNAME }} >> .env && echo DISQUS_APP_URL=${{ secrets.DISQUS_APP_URL }} >> .env | |
- name: Build React App | |
run: npm install && npm run build | |
- name: Map tokens to HTML | |
run: npm run tokens | |
- name: Build Sitemaps | |
run: npm run sitemaps && npm run robots | |
- name: Deploy app build to S3 bucket | |
run: aws s3 sync ./dist/ s3://roethedev --delete | |
- name: Start clearing cloudfront cache | |
run: aws configure set preview.cloudfront true | |
- name: Flush cloudfront cache | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_ID }} --paths "/*" |