This repository has been archived by the owner on May 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (64 loc) · 3.83 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: deploy
on:
push:
env:
MYSQL_HOST: ${{ secrets.MYSQL_HOST }}
MYSQL_USERNAME: ${{ secrets.MYSQL_USERNAME }}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }}
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.gcp_credentials }}"
- uses: actions/setup-python@v2
with:
python-version: 3.9.16
- uses: snok/install-poetry@v1
- id: "install"
run: poetry install --no-interaction --no-root
- id: "mypy"
run: poetry run mypy .
- id: "test"
run: poetry run pytest
- id: "dry-mlb"
run: DRY_RUN=True poetry run python mlb_dryrun.py
- id: "dry-nhl"
run: DRY_RUN=True poetry run python nhl_dryrun.py
- id: "dry-nba"
run: DRY_RUN=True poetry run python nba_dryrun.py
- id: "dry-nfl"
run: DRY_RUN=True poetry run python nfl_dryrun.py
deploy:
runs-on: ubuntu-latest
timeout-minutes: 20
needs: test
if: github.ref == 'refs/heads/main'
permissions:
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v3
- id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.gcp_credentials }}"
- id: "deploy"
uses: "google-github-actions/deploy-cloud-functions@v0"
with:
name: "projects/greg-finley/locations/us-central1/functions/mlb-alphabet-game"
runtime: "python310"
entry_point: "run"
memory_mb: 512
secret_environment_variables: "MLB_TWITTER_ACCESS_SECRET=projects/greg-finley/secrets/MLB_TWITTER_ACCESS_SECRET/versions/latest,MLB_TWITTER_ACCESS_TOKEN=projects/greg-finley/secrets/MLB_TWITTER_ACCESS_TOKEN/versions/latest, MLB_TWITTER_CONSUMER_KEY=projects/greg-finley/secrets/MLB_TWITTER_CONSUMER_KEY/versions/latest, MLB_TWITTER_CONSUMER_SECRET=projects/greg-finley/secrets/MLB_TWITTER_CONSUMER_SECRET/versions/latest, NHL_TWITTER_ACCESS_SECRET=projects/greg-finley/secrets/NHL_TWITTER_ACCESS_SECRET/versions/latest,NHL_TWITTER_ACCESS_TOKEN=projects/greg-finley/secrets/NHL_TWITTER_ACCESS_TOKEN/versions/latest, NHL_TWITTER_CONSUMER_KEY=projects/greg-finley/secrets/NHL_TWITTER_CONSUMER_KEY/versions/latest, NHL_TWITTER_CONSUMER_SECRET=projects/greg-finley/secrets/NHL_TWITTER_CONSUMER_SECRET/versions/latest, NBA_TWITTER_ACCESS_SECRET=projects/greg-finley/secrets/NBA_TWITTER_ACCESS_SECRET/versions/latest,NBA_TWITTER_ACCESS_TOKEN=projects/greg-finley/secrets/NBA_TWITTER_ACCESS_TOKEN/versions/latest, NBA_TWITTER_CONSUMER_KEY=projects/greg-finley/secrets/NBA_TWITTER_CONSUMER_KEY/versions/latest, NBA_TWITTER_CONSUMER_SECRET=projects/greg-finley/secrets/NBA_TWITTER_CONSUMER_SECRET/versions/latest, NFL_TWITTER_ACCESS_SECRET=projects/greg-finley/secrets/NFL_TWITTER_ACCESS_SECRET/versions/latest,NFL_TWITTER_ACCESS_TOKEN=projects/greg-finley/secrets/NFL_TWITTER_ACCESS_TOKEN/versions/latest, NFL_TWITTER_CONSUMER_KEY=projects/greg-finley/secrets/NFL_TWITTER_CONSUMER_KEY/versions/latest, NFL_TWITTER_CONSUMER_SECRET=projects/greg-finley/secrets/NFL_TWITTER_CONSUMER_SECRET/versions/latest, MYSQL_HOST=projects/greg-finley/secrets/MYSQL_HOST/versions/latest,MYSQL_USERNAME=projects/greg-finley/secrets/MYSQL_USERNAME/versions/latest,MYSQL_PASSWORD=projects/greg-finley/secrets/MYSQL_PASSWORD/versions/latest,MYSQL_DATABASE=projects/greg-finley/secrets/MYSQL_DATABASE/versions/latest"
timeout: 120
event_trigger_type: "providers/cloud.pubsub/eventTypes/topic.publish"
event_trigger_resource: "projects/greg-finley/topics/mlb-alphabet-game"
event_trigger_service: "pubsub.googleapis.com"
min_instances: 0
max_instances: 1