Script tidup #233
Workflow file for this run
This file contains 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 | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
uv-sync: | |
# from https://github.com/win845/uv-light/blob/b4fabd9fc4fca621dd91bfe0a90e6ce6f17dd5ce/.github/workflows/push.yml#L7 | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: 'actions/[email protected]' | |
with: | |
fetch-depth: 2 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: UV sync | |
id: uv-sync | |
# a new commit will not trigger this workflow again | |
run: | | |
./scripts/_piptools_to_uv.sh | |
- name: Commit file | |
uses: ryancyq/github-signed-commit@v1 | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
uv.lock | |
requirements.txt | |
commit-message: uv sync | |
deploy: | |
runs-on: ubuntu-latest | |
needs: uv-sync | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
concurrency: "prod" | |
steps: | |
- uses: 'actions/[email protected]' | |
- id: 'auth' | |
name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/[email protected]' | |
with: | |
workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ vars.GCP_SERVICE_ACCOUNT }} | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version-file: "pyproject.toml" | |
- name: Install | |
run: uv sync | |
- name: Test | |
run: uv run pytest -v | |
- name: Generate Requirements | |
run: ./scripts/_generate_requirements.sh | |
- id: 'deploy' | |
uses: 'google-github-actions/[email protected]' | |
with: | |
name: "update2" | |
runtime: 'python312' | |
environment: GEN_2 | |
max_instance_count: 2 | |
entry_point: "update2" | |
# TODO put these all in github or all in gcp | |
environment_variables: |- | |
DEVICE_ID=${{ vars.DEVICE_ID}} | |
secrets: |- | |
ASTRAL_LOCATION=projects/${{ steps.auth.outputs.project_id}}/secrets/ASTRAL_LOCATION/versions/latest | |
SUREPY_TOKEN=projects/${{ steps.auth.outputs.project_id}}/secrets/SUREPY_AUTH_TOKEN/versions/latest | |
- name: Trigger deployed function | |
run: | |
curl ${{ steps.deploy.outputs.url }} --fail-with-body |