Skip to content

Commit

Permalink
Create branch.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tcdev00 committed Aug 30, 2023
1 parent f091037 commit a918b4f
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Branch

# Branch name is going to change. This first name is for a PoC
on:
push:
branches:
- env/test

defaults:
run:
working-directory: packages/client

env:
BUCKET_WEB: reactive-analytics-test-static-content

jobs:
build:
name: Build & deploy

runs-on: ubuntu-20.04

if: github.repository_owner == 'AdaptiveConsulting'

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set Node version
uses: actions/setup-node@v3
with:
node-version: 20

# URL_SUFFIX is used so we can append branch/<branch-name> to BASE_URL, or leave blank in the case of uat/dev where we do not need it
- name: Set variables
id: vars
run: |
echo "BRANCH=$(echo $GITHUB_REF_NAME | sed 's/\//_/g')" >> $GITHUB_OUTPUT
echo "ENVIRONMENT=$( ([[ $GITHUB_REF_NAME = env/test ]] && echo 'test') || ([[ $GITHUB_REF_NAME = master ]] && echo 'dev') || echo 'env' )" >> $GITHUB_OUTPUT
echo "URL_SUFFIX=$( ([[ $GITHUB_REF_NAME = env/test || $GITHUB_REF_NAME = master ]] && echo '') || echo /branch/$(echo $GITHUB_REF_NAME | sed 's/\//_/g') )" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCLOUD_SERVICE_ACCOUNT_JSON }}"

- name: Set up GCloud
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GOOGLE_PROJECT_ID }}

- name: Install
run: |
cd client
yarn install --frozen-lockfile
- name: Verify Quality
run: |
yarn verify
- name: Build (web)
run: |
yarn build
- name: Deploy (web)
run: |
gsutil -m \
-h "Cache-Control: no-cache" \
rsync -d -r dist \
gs://$BUCKET_WEB/

0 comments on commit a918b4f

Please sign in to comment.