This file contains hidden or 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
#basic transformation on the dataframe to have the right format | |
ga_raw_data = ga_raw_data.filter(items=['date', 'user_id', 'journey_id', 'utm_medium', 'submitted_applications']) | |
ga_raw_data = ga_raw_data.sort_values(by=['date', 'user_id'], ascending=True) | |
ga_raw_data['submitted_applications'] = ga_raw_data['submitted_applications'].astype(str).astype(int) | |
ga_raw_data['date'] = pd.to_datetime(ga_raw_data['date']) | |
ga_raw_data = ga_raw_data.reset_index().drop(columns=['index']) | |
ga_raw_data.head() |
This file contains hidden or 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
#import the json file with the google credentials | |
with open("google_credentials.json", "r") as f: | |
google_credentials = json.load(f) | |
#load the credentials in the right variable | |
scope = ['https://www.googleapis.com/auth/cloud-platform', 'https://spreadsheets.google.com/feeds'] | |
credentials_gs = ServiceAccountCredentials.from_json_keyfile_dict(google_credentials, scope) | |
gc = gspread.authorize(credentials_gs) | |
#pull data from the right google spreadsheet and insert it into a dataframe |
This file contains hidden or 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 Release on cluster | |
env: | |
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }} | |
run: | | |
echo "$GCLOUD_KEY" | base64 --decode > ${HOME}/gcloud.json | |
gcloud auth activate-service-account --key-file=${HOME}/gcloud.json | |
gcloud auth configure-docker | |
gcloud container clusters get-credentials \ | |
${{ env.CLUSTER_NAME }} --zone | |
${{ env.CLUSTER_ZONE }} --project ${{ env.PROJECT_NAME }} |
This file contains hidden or 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: Install kubectl | |
run: | | |
sudo apt-get install kubectl | |
- name: Install helm | |
run: | | |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | |
chmod 700 get_helm.sh | |
./get_helm.sh |
This file contains hidden or 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
deployment: | |
name: Deploy backend to cluster | |
runs-on: 'ubuntu-latest' | |
needs: [docker-image] | |
steps: | |
- name: Checkout working branch | |
uses: actions/checkout@v1 | |
- name: Set Release version | |
run: | |
This file contains hidden or 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: Publish Docker Image | |
uses: elgohr/[email protected] | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
with: | |
name: ${{ env.DOCKER_IMAGE }} | |
username: ${{ steps.gcloud.outputs.username }} | |
password: ${{ steps.gcloud.outputs.password }} | |
registry: ${{ env.DOCKER_REGISTRY }} | |
tag_names: true |
This file contains hidden or 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
jobs: | |
validate-release-name: | |
name: Validate release name | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: Checkout working branch | |
uses: actions/checkout@v2 | |
- name: Checkout private actions repo | |
uses: actions/checkout@v2 |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
set -o pipefail | |
echo "Start validation $1" | |
BRANCH=$(git branch -r --contains ${GITHUB_SHA} | grep "") | |
RELEASE_VERSION=$(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g" | sed -e "s/\//-/g") |
This file contains hidden or 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: 'Validate tags' | |
author: 'Hugobert Humperdinck' | |
description: 'Validate release/pre-release tags' | |
inputs: | |
prerelease: | |
description: 'Tag is prerelease' | |
required: true | |
runs: | |
using: 'docker' | |
image: 'Dockerfile' |
This file contains hidden or 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: Login to gcloud registry | |
id: gcloud | |
uses: elgohr/[email protected] | |
with: | |
account_key: ${{ secrets.GCLOUD_KEY }} | |
- name: Publish Docker Image | |
uses: elgohr/[email protected] | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} |