Skip to content

Commit

Permalink
Added Auth API
Browse files Browse the repository at this point in the history
  • Loading branch information
AdenForshaw committed Oct 30, 2024
1 parent ffcd2ba commit c11d3e2
Show file tree
Hide file tree
Showing 18 changed files with 788 additions and 91 deletions.
51 changes: 29 additions & 22 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
name: Deploy to Cloud Run

name: Default test
on:
push:
branches:
- main
branches-ignore:
- 'master'
- 'staging'

jobs:
deploy:
name: Deploy to Cloud Run
test-build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]

steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Set up Google Cloud SDK
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }} # Set this secret in your GitHub repo
service_account_key: ${{ secrets.GCP_SA_KEY }} # Set this secret in your GitHub repo
export_default_credentials: true

# Step 3: Trigger Cloud Build
- name: Trigger Cloud Build
run: |
gcloud builds submit --config cloudbuild.yaml --substitutions=_PROJECT_ID=${{ secrets.GCP_PROJECT_ID }}
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: npm install
run: |
npm install
- name: npm test
run: |
npm test
- name: npm test:e2e
run: |
npm run test:e2e
- name: npm build
run: |
npm run build --if-present
76 changes: 76 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Deploy Production to Google Cloud Run
on:
workflow_dispatch:
inputs:
trigger:
description: 'Production Deploy'
required: true
default: 'build and deploy'

jobs:
test-build:
name: Production - ${{ github.event.head_commit.message }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [21.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: npm install
run: |
npm install
- name: npm test
run: |
npm test
- name: npm test:e2e
run: |
npm run test:e2e
- name: npm build
run: |
npm run build --if-present
setup-build-publish-deploy:
needs: [test-build]
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master

- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GCLOUD_SERVICE_KEY }}'

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'

- name: 'Use gcloud CLI'
run: 'gcloud info'

- run: |
# Set up docker to authenticate
# via gcloud command-line tool.
gcloud auth configure-docker
# Build the Docker image
- name: Build
run: |
docker build . --tag gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/${{ secrets.GCLOUD_APP_NAME }}
# Push the Docker image to Google Container Registry
- name: Publish
run: |
docker push gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/${{ secrets.GCLOUD_APP_NAME }}
# Deploy the Docker image to the GKE cluster
- name: Deploy
run: |
gcloud components install beta && gcloud beta run deploy ${{ secrets.GCLOUD_APP_NAME }} --image gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/${{ secrets.GCLOUD_APP_NAME }}:latest --project ${{ secrets.GCLOUD_PROJECT_ID }} --region us-central1 --allow-unauthenticated --platform managed
14 changes: 10 additions & 4 deletions extra-datasets/brands/brand-to-wikidata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[
{"brand": "Woolworths Metro","wikidata":"Q111772555", "operator": "Woolworths Group", "brand:wikidata": "Q607272"},
{"brand": "Woolworths","wikidata":"Q3249145", "operator": "Woolworths Group", "brand:wikidata": "Q607272"},
{"brand": "Coles","wikidata":"Q1108172", "operator": "Coles Group", "brand:wikidata": "Q1339055"},
{"brand": "Coles Express","wikidata":"Q5144653", "operator": "Coles Group", "brand:wikidata": "Q1339055"}
{"brand": "Woolworths Metro","wikidata":"Q111772555", "operator": "Woolworths Group", "brand:wikidata": "Q607272", "countries":["AU"]},
{"brand": "Woolworths","wikidata":"Q3249145", "operator": "Woolworths Group", "brand:wikidata": "Q607272", "countries":["AU"]},
{"brand": "Coles","wikidata":"Q1108172", "operator": "Coles Group", "brand:wikidata": "Q1339055", "countries":["AU"]},
{"brand": "Coles Express","wikidata":"Q5144653", "operator": "Coles Group", "brand:wikidata": "Q1339055", "countries":["AU"]},
{"brand":"Australia Post","wikidata":"Q1142936", "countries":["AU"]},
{"brand":"TAB","wikidata":"Q110288149", "countries":["AU"]},
{"brand":"BWS","wikidata":"Q4836848", "countries":["AU"]},
{"brand":"BP","wikidata":"Q50736918", "countries":["AU"], "operator": "BP", "brand:wikidata": "Q152057" },
{"brand":"Subway Australia","wikidata":"Q244457" , "countries":["AU"], "operator": "Subway", "brand:wikidata": "Q244457"},
{"brand":"McDonald's","wikidata":"Q82813727", "countries":["AU"], "operator": "McDonald’s", "brand:wikidata": "Q38076" }
]
Loading

0 comments on commit c11d3e2

Please sign in to comment.