chore: Use Env globally #123
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
name: Deploy to AWS S3 | |
on: | |
push: | |
branches: ['main', 'dev'] | |
release: | |
types: [published] | |
env: | |
NODE_VERSION: 18 | |
NODE_AUTH_TOKEN: ${{ secrets.STAFFBOT_NPM_READ }} | |
DEPLOYMENT_KIND: widget | |
DEPLOYMENT_TARGET: weather | |
DEPLOYMENT_STATIC_FILES: staffbase.user-profile-client.min.js | |
DEPLOYMENT_SOURCE: samples/weather-forecast/dist | |
jobs: | |
prepare-deployment: | |
name: Prepare Deployment | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
# persisting credentials breaks installing dependencies from private repos | |
persist-credentials: false | |
# fetch all history for all branches and tags | |
fetch-depth: 0 | |
- name: Use Node JS | |
uses: actions/setup-node@v4 | |
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 | |
continuous-delivery-dev-de1: | |
name: Continuous Delivery (dev de1) | |
needs: prepare-deployment | |
runs-on: ubuntu-22.04 | |
if: github.ref == 'refs/heads/dev' | |
steps: | |
- name: Deploy | |
uses: Staffbase/[email protected] | |
with: | |
source: ${{ env.DEPLOYMENT_SOURCE }} | |
deployment_kind: ${{ env.DEPLOYMENT_KIND }} | |
target: ${{ env.DEPLOYMENT_TARGET }} | |
# Varnish settings | |
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }} | |
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_DEV_DE1_PASSWORD }} | |
frontend_cache_host: frontend-cache-de1.staffbase.dev | |
# AWS specific settings | |
aws_region: eu-central-1 | |
aws_bucket: staffbasestatic-dev-de1 | |
aws_access_key_id: ${{ secrets.DEV_DE1_AWS_ACCESS_KEY_ID }} | |
aws_access_key_secret: ${{ secrets.DEV_DE1_AWS_ACCESS_KEY_SECRET }} | |
continuous-delivery-stage-de1: | |
name: Continuous Delivery (stage de1) | |
needs: prepare-deployment | |
runs-on: ubuntu-22.04 | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Deploy | |
uses: Staffbase/[email protected] | |
with: | |
source: ${{ env.DEPLOYMENT_SOURCE }} | |
deployment_kind: ${{ env.DEPLOYMENT_KIND }} | |
target: ${{ env.DEPLOYMENT_TARGET }} | |
# Varnish settings | |
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }} | |
frontend_cache_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_id: ${{ secrets.STAGE_DE1_AWS_ACCESS_KEY_ID }} | |
aws_access_key_secret: ${{ secrets.STAGE_DE1_AWS_ACCESS_KEY_SECRET }} | |
continuous-delivery-prod-de1: | |
name: Continuous Delivery (prod de1) | |
needs: prepare-deployment | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Deploy | |
uses: Staffbase/[email protected] | |
with: | |
source: ${{ env.DEPLOYMENT_SOURCE }} | |
deployment_kind: ${{ env.DEPLOYMENT_KIND }} | |
target: ${{ env.DEPLOYMENT_TARGET }} | |
# Varnish settings | |
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }} | |
frontend_cache_host: frontend-cache-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_id: ${{ secrets.PROD_DE1_AWS_ACCESS_KEY_ID }} | |
aws_access_key_secret: ${{ secrets.PROD_DE1_AWS_ACCESS_KEY_SECRET }} | |
continuous-delivery-prod-us1: | |
name: Continuous Delivery (prod us1) | |
needs: prepare-deployment | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Deploy | |
uses: Staffbase/[email protected] | |
with: | |
source: ${{ env.DEPLOYMENT_SOURCE }} | |
deployment_kind: ${{ env.DEPLOYMENT_KIND }} | |
target: ${{ env.DEPLOYMENT_TARGET }} | |
# Varnish settings | |
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }} | |
frontend_cache_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_id: ${{ secrets.PROD_US1_AWS_ACCESS_KEY_ID }} | |
aws_access_key_secret: ${{ secrets.PROD_US1_AWS_ACCESS_KEY_SECRET }} |