-
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (52 loc) · 1.76 KB
/
job-deploy.yaml
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
name: Build and Deploy to Cloud Run Job
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- '*.md'
- '*.txt'
- 'LICENSE'
- .gitattributes
- .gitignore
workflow_dispatch:
env:
PROJECT_ID: pypi-package-analysis-437421
GAR_LOCATION: us-east4
REPO_NAME: pypi-package-analysis-ar
JOB_NAME: pypi-package-analysis-job
REGION: us-east4
jobs:
deploy:
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Google Auth
id: auth
uses: "google-github-actions/auth@v2"
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Configure Docker for Google Artifact Registry
run: |
gcloud auth configure-docker '${{ env.GAR_LOCATION }}-docker.pkg.dev'
- name: Build Container
run: |-
docker build -t ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}/application-job:${{ github.sha }} ./
- name: Push Container
run: docker push ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}/application-job:${{ github.sha }}
- name: Deploy or Update Cloud Run Job
run: |-
gcloud run jobs update ${{ env.JOB_NAME }} \
--image=${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}/application-job:${{ github.sha }} \
--region=${{ env.REGION }} \
--task-timeout=600s \
--max-retries=3
- name: Show Output
run: echo "Cloud Run Job ${{ env.JOB_NAME }} deployed/updated successfully in region ${{ env.REGION }}"
environment:
name: Production