Skip to content

Merge pull request #48 from Staffbase/CIV-335 #113

Merge pull request #48 from Staffbase/CIV-335

Merge pull request #48 from Staffbase/CIV-335 #113

Workflow file for this run

name: Deploy to AWS S3
on:
push:
branches: ['main', 'dev']
release:
types: [published]
env:
NODE_VERSION: 16
jobs:
build-and-deploy:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use Node JS
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: samples/weather-forecast/yarn.lock
registry-url: 'https://npm.pkg.github.com/'
scope: '@staffbase'
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.STAFFBOT_NPM_READ }}" >> samples/weather-forecast/.npmrc
- name: Yarn install
run: yarn install --cwd samples/weather-forecast --frozen-lockfile
- name: Build widget
run: yarn --cwd samples/weather-forecast build
- name: Prepare Deployment
run: |
mkdir samples/weather-forecast/icons
cp samples/weather-forecast/resources/weather-forecast.svg samples/weather-forecast/dist/icons
- uses: actions/checkout@v3
with:
persist-credentials: false
repository: Staffbase/S3-deployment-action
ref: 1.0.1
token: ${{ secrets.GITOPS_TOKEN }}
path: .github/gitops
- name: Publish to S3 DE Prod
if: github.event.release.tag_name != null
uses: ./.github/gitops
with:
source: samples/weather-forecast/dist
destination: widgets/weather
# Varnish settings
static_files: |
manifest.json
frontend_host: frontend-cache-main-de1.staffbase.com
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_DE1_PASSWORD }}
# AWS specific settings
aws_bucket: staffbasestatic-prod-de1
aws_region: eu-central-1
aws_access_key: ${{ secrets.PROD_DE1_AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.PROD_DE1_AWS_ACCESS_KEY_SECRET }}
- name: Deploy to S3 US Prod
if: github.event.release.tag_name != null
uses: ./.github/gitops
with:
source: samples/weather-forecast/dist
destination: widgets/weather
# Varnish settings
static_files: |
manifest.json
frontend_host: frontend-cache-us1.staffbase.com
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_US1_PASSWORD }}
# AWS specific settings
aws_bucket: staffbasestatic-prod-us1
aws_region: us-east-1
aws_access_key: ${{ secrets.PROD_US1_AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.PROD_US1_AWS_ACCESS_KEY_SECRET }}
- name: Publish to S3 DE stage
if: github.ref == 'refs/heads/main'
uses: ./.github/gitops
with:
source: samples/weather-forecast/dist
destination: widgets/weather
# Varnish settings
static_files: |
manifest.json
frontend_host: frontend-cache-de1.staffbase.rocks
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_STAGE_DE1_PASSWORD }}
# AWS specific settings
aws_bucket: staffbasestatic-stage-de1
aws_region: eu-central-1
aws_access_key: ${{ secrets.STAGE_DE1_AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.STAGE_DE1_AWS_ACCESS_KEY_SECRET }}
- name: Publish to S3 DE dev
if: github.ref == 'refs/heads/dev'
uses: ./.github/gitops
with:
source: samples/weather-forecast/dist
destination: widgets/weather
# Varnish settings
static_files: |
manifest.json
frontend_host: frontend-cache-de1.staffbase.dev
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_DEV_DE1_PASSWORD }}
# AWS specific settings
aws_bucket: staffbasestatic-dev-de1
aws_region: eu-central-1
aws_access_key: ${{ secrets.DEV_DE1_AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.DEV_DE1_AWS_ACCESS_KEY_SECRET }}