mirror of
https://github.com/harry0703/MoneyPrinterTurbo.git
synced 2026-02-22 17:07:22 +08:00
45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
name: Deploy Google Cloud Function
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- develop
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r function/requirements.txt
|
|
|
|
- name: Authenticate to Google Cloud
|
|
uses: google-github-actions/auth@v1
|
|
with:
|
|
credentials_json: "${{ secrets.GCP_SA_KEY }}"
|
|
|
|
- name: Deploy Google Cloud Function
|
|
run: |
|
|
gcloud functions deploy moneyprinterturbo-function \
|
|
--runtime python310 \
|
|
--trigger-http \
|
|
--entry-point main \
|
|
--source function \
|
|
--region "${{ secrets.GCP_REGION }}" \
|
|
--set-env-vars API_URL="${{ secrets.API_URL }}",VIDEO_SUBJECT="${{ vars.VIDEO_SUBJECT }}",VIDEO_DESCRIPTION="${{ vars.VIDEO_DESCRIPTION }}",ACCOUNT_NAME="${{ vars.ACCOUNT_NAME }}",TIME_BEFORE_DOWNLOAD="${{ vars.TIME_BEFORE_DOWNLOAD }}"
|
|
|
|
- name: Upload music.mp3 to Google Cloud Storage
|
|
run: |
|
|
gcloud auth activate-service-account --key-file="${{ secrets.GCP_SA_KEY }}"
|
|
gsutil cp function/music.mp3 gs://"${{ vars.GCP_BUCKET_NAME }}"/music.mp3 |