Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Commit

Permalink
deploy to GH pages
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSp committed Jul 23, 2020
1 parent 2686a22 commit 660607a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 92 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ on:
branches:
- master

# Environment variables available to all jobs and steps in this workflow
env:
GITHUB_SHA: ${{ github.sha }}

jobs:
run-test:
name: Test
Expand Down
85 changes: 16 additions & 69 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,88 +7,35 @@ on:
branches:
- master

# Environment variables available to all jobs and steps in this workflow
env:
GKE_PROJECT_ID: ${{ secrets.GKE_PROJECT_ID }}
GKE_EMAIL: ${{ secrets.GKE_EMAIL }}
CLOUD_SQL_SERVICE_ACCOUNT: ${{ secrets.CLOUD_SQL_SERVICE_ACCOUNT }}
CLOUD_STORE_SERVICE_ACCOUNT: ${{ secrets.CLOUD_STORE_SERVICE_ACCOUNT }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
GITHUB_SHA: ${{ github.sha }}
GKE_ZONE: europe-west4-b
GKE_CLUSTER: prod
REGISTRY_HOSTNAME: eu.gcr.io

jobs:
setup-build-publish-deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/[email protected]
with:
node-version: '14'

# begin caching
- name: Get yarn cache directory path
id: yarn-cache-dir-path
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# end caching

# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '270.0.0'
service_account_email: ${{ secrets.GKE_EMAIL }}
service_account_key: ${{ secrets.GKE_KEY }}
project_id: ${{ secrets.GKE_PROJECT_ID }}
- uses: actions/[email protected]
with:
java-version: 1.11

# Configure docker to use the gcloud command-line tool as a credential helper
- run: |
# Set up docker to authenticate
# via gcloud command-line tool.
gcloud auth configure-docker
# Build and push image to Google Container Registry
- name: Build
run: |-
gradle jib
# Deploy the Docker image to the GKE cluster
- name: Prepare Helm
uses: azure/setup-helm@v1
with:
version: v3.1.2
- run: yarn install --frozen-lockfile
- run: yarn build

- name: Deploy
run: |
gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE" --project "$GKE_PROJECT_ID"
echo -n "${CLOUD_SQL_SERVICE_ACCOUNT}" > chart/cloudsql.base64.json
echo -n "${CLOUD_STORE_SERVICE_ACCOUNT}" > chart/cloudstore.base64.json
helm repo add stable "https://kubernetes-charts.storage.googleapis.com"
helm upgrade --install traefik stable/traefik -f chart/traefik.values.yaml
values=""
target="${GITHUB_REF//refs\/heads\//}"
if [[ "$GITHUB_EVENT_NAME" == "release" ]]; then
target="production"
elif [[ -f "chart/values.${target}.yml" ]]; then
values="-f chart/values.${target}.yml"
else
echo "unkown target ${target}"
exit 42
fi
helm upgrade --install "imis-${target}" chart $values \
--set gitSha=${GITHUB_SHA} --set "secrets.postgres=$(echo -n ${POSTGRES_PASSWORD} | base64)"
kubectl rollout status "deployment/imis-${target}"
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
23 changes: 4 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ client/.vscode
.vscode
**/.project
**/.settings
/.classpath
# CMake
cmake-build-*/

# TODO
#client/src/store/ImisSwaggerApi.ts

# File-based project format
*.iws
Expand All @@ -33,10 +27,6 @@ crashlytics.properties
crashlytics-build.properties
fabric.properties

### Java ###
# Compiled class file
*.class

# Log file
*.log

Expand All @@ -48,7 +38,6 @@ fabric.properties

# Package Files #
*.jar
!gradle/wrapper/gradle-wrapper.jar
*.war
*.nar
*.ear
Expand All @@ -66,13 +55,9 @@ hs_err_pid*

### Node
node_modules
client/dist
# we use client/yarn.lock instead!
client/package-lock.json
dist

# Log files
client/npm-debug.log*
client/yarn-debug.log*
client/yarn-error.log*
/build/
/venv/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

0 comments on commit 660607a

Please sign in to comment.