|
| 1 | +name: Staging |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +env: |
| 9 | + ALGOLIA_ADMIN_KEY: ${{ secrets.STAGING_CI_ALGOLIA_ADMIN_KEY }) |
| 10 | + AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_CI_AWS_ACCESS_KEY }} |
| 11 | + AWS_CLOUDFRONT_DISTRIBUTION_ID: $({ secrets.STAGING_CI_AWS_CLOUDFRONT_DISTRIBUTION_ID}) |
| 12 | + AWS_REGION: 'eu-west-1' |
| 13 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_CI_AWS_SECRET_KEY }} |
| 14 | + BUCKET_NAME: $({ secrets.STAGING_CI_BUCKET_NAME }) |
| 15 | + BUCKET_REGION: $({ secrets.STAGING_CI_BUCKET_REGION }) |
| 16 | + GATSBY_ALGOLIA_APP_ID: $({ secrets.STAGING_CI_GATSBY_ALGOLIA_APP_ID }) |
| 17 | + GATSBY_ALGOLIA_INDEX_NAME: $({ secrets.STAGING_CI_GATSBY_ALGOLIA_INDEX_NAME }) |
| 18 | + GATSBY_ALGOLIA_SEARCH_ONLY_KEY: $({ secrets.STAGING_CI_GATSBY_ALGOLIA_SEARCH_ONLY_KEY }) |
| 19 | + GATSBY_DEFAULT_APP_URL: https://app.$({ secrets.STAGING_CI_MAIN_URL }) |
| 20 | + GATSBY_DEFAULT_BLOG_URL: https://$({ secrets.STAGING_CI_MAIN_URL })/blog |
| 21 | + GATSBY_DEFAULT_DOC_URL: https://$({ secrets.STAGING_CI_MAIN_URL })/docs |
| 22 | + GATSBY_DEFAULT_MAIN_URL: https://$({ secrets.STAGING_CI_MAIN_URL }) |
| 23 | + GATSBY_DRIFT_API: $({ secrets.STAGING_CI_GATSBY_DRIFT_API }) |
| 24 | + GATSBY_GOOGLE_API_KEY: $({ secrets.STAGING_CI_GATSBY_GOOGLE_API_KEY }) |
| 25 | +jobs: |
| 26 | + lint: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - name: Checkout project |
| 30 | + uses: actions/checkout@v2 |
| 31 | + - name: Use Node.js 12.xs |
| 32 | + uses: actions/setup-node@v1 |
| 33 | + with: |
| 34 | + node-version: '12.x' |
| 35 | + registry-url: 'https://registry.npmjs.org' |
| 36 | + - name: Restore cache |
| 37 | + uses: actions/cache@v2 |
| 38 | + with: |
| 39 | + path: '**/node_modules' |
| 40 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} |
| 41 | + - name: Install dependencies |
| 42 | + run: npm install |
| 43 | + - name: Run linter |
| 44 | + run: | |
| 45 | + npm run lint |
| 46 | + npm run lint:prose |
| 47 | + build: |
| 48 | + runs-on: ubuntu-latest |
| 49 | + needs: |
| 50 | + - lint |
| 51 | + steps: |
| 52 | + - name: Checkout project |
| 53 | + uses: actions/checkout@v2 |
| 54 | + - name: Use Node.js 12.xs |
| 55 | + uses: actions/setup-node@v1 |
| 56 | + with: |
| 57 | + node-version: '12.x' |
| 58 | + registry-url: 'https://registry.npmjs.org' |
| 59 | + - name: Restore cache |
| 60 | + uses: actions/cache@v2 |
| 61 | + with: |
| 62 | + path: '**/node_modules' |
| 63 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} |
| 64 | + - name: Install dependencies |
| 65 | + run: npm install |
| 66 | + - name: Build project |
| 67 | + run: npm run build |
| 68 | + - name: Upload artifact |
| 69 | + uses: actions/upload-artifact@v2 |
| 70 | + with: |
| 71 | + name: k6-docs |
| 72 | + path: public/ |
| 73 | + deploy-to-staging: |
| 74 | + runs-on: ubuntu-latest |
| 75 | + needs: |
| 76 | + - lint |
| 77 | + - build |
| 78 | + steps: |
| 79 | + - name: Download artifact |
| 80 | + uses: actions/download-artifact@v2 |
| 81 | + with: |
| 82 | + name: k6-docs |
| 83 | + path: public/ |
| 84 | + - name: Install AWS CLI dependencies |
| 85 | + run: sudo apt-get update && sudo apt-get -y install python-pip python-dev |
| 86 | + - name: Install AWS CLI |
| 87 | + run: sudo pip install awscli |
| 88 | + - name: Deploy |
| 89 | + run: npm run deploy |
0 commit comments