|
1 |
| -name: Deploy samples to Netlify |
2 |
| -env: |
3 |
| - NODE_VERISON: 14 |
| 1 | +name: Deploy to AWS S3 |
| 2 | + |
4 | 3 | on:
|
5 | 4 | push:
|
6 |
| - paths-ignore: |
7 |
| - - '**.md' |
| 5 | + branches: ['main', 'dev'] |
| 6 | + release: |
| 7 | + types: [published] |
| 8 | + |
| 9 | +env: |
| 10 | + NODE_VERSION: 16 |
8 | 11 |
|
9 | 12 | jobs:
|
10 | 13 | build-and-deploy:
|
11 |
| - if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' |
12 |
| - runs-on: ubuntu-20.04 |
| 14 | + runs-on: ubuntu-22.04 |
13 | 15 |
|
14 | 16 | steps:
|
15 | 17 | - name: Checkout repository
|
16 |
| - uses: actions/checkout@v2 |
| 18 | + uses: actions/checkout@v3 |
17 | 19 |
|
18 | 20 | - name: Use Node JS
|
19 |
| - uses: actions/setup-node@v2 |
| 21 | + uses: actions/setup-node@v3 |
20 | 22 | with:
|
21 | 23 | node-version: ${{ env.NODE_VERSION }}
|
| 24 | + cache: 'yarn' |
| 25 | + cache-dependency-path: samples/weather-forecast/yarn.lock |
| 26 | + registry-url: 'https://npm.pkg.github.com/' |
| 27 | + scope: '@staffbase' |
| 28 | + |
| 29 | + - run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.STAFFBOT_NPM_READ }}" >> samples/weather-forecast/.npmrc |
22 | 30 |
|
23 |
| - - name: Install Yarn Dependencies |
| 31 | + - name: Yarn install |
24 | 32 | run: yarn install --cwd samples/weather-forecast --frozen-lockfile
|
25 | 33 |
|
26 | 34 | - name: Build widget
|
27 | 35 | run: yarn --cwd samples/weather-forecast build
|
28 | 36 |
|
29 | 37 | - name: Prepare Deployment
|
30 | 38 | run: |
|
31 |
| - mkdir -p samples/deploy/icons |
32 |
| - cp samples/netlify.toml samples/deploy/ |
33 |
| - cp samples/weather-forecast/dist/* samples/deploy/ |
34 |
| - cp samples/weather-forecast/resources/weather-forecast.svg samples/deploy/icons/ |
35 |
| -
|
36 |
| - - name: Publish to Production |
37 |
| - if: github.ref == 'main' |
38 |
| - uses: netlify/actions/cli@master |
| 39 | + mkdir samples/weather-forecast/icons |
| 40 | + cp samples/weather-forecast/resources/weather-forecast.svg samples/weather-forecast/dist/icons |
| 41 | +
|
| 42 | + - uses: actions/checkout@v3 |
| 43 | + with: |
| 44 | + persist-credentials: false |
| 45 | + repository: Staffbase/S3-deployment-action |
| 46 | + ref: 1.0.1 |
| 47 | + token: ${{ secrets.GITOPS_TOKEN }} |
| 48 | + path: .github/gitops |
| 49 | + |
| 50 | + - name: Publish to S3 DE Prod |
| 51 | + if: github.event.release.tag_name != null |
| 52 | + uses: ./.github/gitops |
| 53 | + with: |
| 54 | + source: samples/weather-forecast/dist |
| 55 | + destination: widgets/weather |
| 56 | + |
| 57 | + # Varnish settings |
| 58 | + static_files: | |
| 59 | + manifest.json |
| 60 | + frontend_host: frontend-cache-main-de1.staffbase.com |
| 61 | + frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_DE1_PASSWORD }} |
| 62 | + |
| 63 | + # AWS specific settings |
| 64 | + aws_bucket: staffbasestatic-prod-de1 |
| 65 | + aws_region: eu-central-1 |
| 66 | + aws_access_key: ${{ secrets.PROD_DE1_AWS_ACCESS_KEY_ID }} |
| 67 | + aws_secret_key: ${{ secrets.PROD_DE1_AWS_ACCESS_KEY_SECRET }} |
| 68 | + |
| 69 | + - name: Deploy to S3 US Prod |
| 70 | + if: github.event.release.tag_name != null |
| 71 | + uses: ./.github/gitops |
| 72 | + with: |
| 73 | + source: samples/weather-forecast/dist |
| 74 | + destination: widgets/weather |
| 75 | + |
| 76 | + # Varnish settings |
| 77 | + static_files: | |
| 78 | + manifest.json |
| 79 | + frontend_host: frontend-cache-us1.staffbase.com |
| 80 | + frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_US1_PASSWORD }} |
| 81 | + |
| 82 | + # AWS specific settings |
| 83 | + aws_bucket: staffbasestatic-prod-us1 |
| 84 | + aws_region: us-east-1 |
| 85 | + aws_access_key: ${{ secrets.PROD_US1_AWS_ACCESS_KEY_ID }} |
| 86 | + aws_secret_key: ${{ secrets.PROD_US1_AWS_ACCESS_KEY_SECRET }} |
| 87 | + |
| 88 | + - name: Publish to S3 DE stage |
| 89 | + if: github.ref == 'refs/heads/main' |
| 90 | + uses: ./.github/gitops |
39 | 91 | with:
|
40 |
| - args: deploy --prod --dir=samples/deploy |
41 |
| - env: |
42 |
| - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
43 |
| - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 92 | + source: samples/weather-forecast/dist |
| 93 | + destination: widgets/weather |
| 94 | + |
| 95 | + # Varnish settings |
| 96 | + static_files: | |
| 97 | + manifest.json |
| 98 | + frontend_host: frontend-cache-de1.staffbase.rocks |
| 99 | + frontend_cache_password: ${{ secrets.FRONTEND_CACHE_STAGE_DE1_PASSWORD }} |
| 100 | + |
| 101 | + # AWS specific settings |
| 102 | + aws_bucket: staffbasestatic-stage-de1 |
| 103 | + aws_region: eu-central-1 |
| 104 | + aws_access_key: ${{ secrets.STAGE_DE1_AWS_ACCESS_KEY_ID }} |
| 105 | + aws_secret_key: ${{ secrets.STAGE_DE1_AWS_ACCESS_KEY_SECRET }} |
44 | 106 |
|
45 |
| - - name: Publish to DevelopmentPreview |
| 107 | + - name: Publish to S3 DE dev |
46 | 108 | if: github.ref == 'refs/heads/dev'
|
47 |
| - uses: netlify/actions/cli@master |
| 109 | + uses: ./.github/gitops |
48 | 110 | with:
|
49 |
| - args: deploy --prod --dir=samples/deploy/ |
50 |
| - env: |
51 |
| - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_DEV }} |
52 |
| - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN_DEV }} |
| 111 | + source: samples/weather-forecast/dist |
| 112 | + destination: widgets/weather |
| 113 | + |
| 114 | + # Varnish settings |
| 115 | + static_files: | |
| 116 | + manifest.json |
| 117 | + frontend_host: frontend-cache-de1.staffbase.dev |
| 118 | + frontend_cache_password: ${{ secrets.FRONTEND_CACHE_DEV_DE1_PASSWORD }} |
| 119 | + |
| 120 | + # AWS specific settings |
| 121 | + aws_bucket: staffbasestatic-dev-de1 |
| 122 | + aws_region: eu-central-1 |
| 123 | + aws_access_key: ${{ secrets.DEV_DE1_AWS_ACCESS_KEY_ID }} |
| 124 | + aws_secret_key: ${{ secrets.DEV_DE1_AWS_ACCESS_KEY_SECRET }} |
0 commit comments