-
Notifications
You must be signed in to change notification settings - Fork 350
85 lines (74 loc) · 3.03 KB
/
image-build-and-push-internal.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
name: Build and publish marvin internal bot image
on:
push:
branches:
- main
paths:
- .github/workflows/image-build-and-push-internal.yaml
- cookbook/slackbot/**
schedule:
# Schedule to run at 7:30PM every Sunday
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: 30 19 * * 0
workflow_dispatch: {}
# Limit concurrency by workflow/branch combination.
#
# For builds, pushing additional changes to the
# branch will cancel prior in-progress and pending builds.
#
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Do not grant jobs any permissions by default
permissions: {}
jobs:
build_push_image:
name: Build marvin internal bot image
runs-on: ubuntu-latest
permissions:
# required to initiate a downstream workflow (read needed for codeql scan)
actions: write
# required to read from the repo
contents: read
# required to obtain Google Cloud service account credentials
id-token: write
# required to upload CodeQL scan results to GitHub
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GHA_WORKLOAD_IDENTITY_PROVIDER }}
service_account: marvin-general-main@prefect-org-github-actions.iam.gserviceaccount.com
- name: Configure Google Cloud credential helper
run: gcloud auth configure-docker --quiet us-docker.pkg.dev
- name: Get image version
run: |
short_sha=$(git rev-parse --short=7 HEAD)
echo "short_sha: ${short_sha}"
echo "SHORT_SHA=${short_sha}" >> $GITHUB_ENV
- name: Build container image
run: |
docker build -f cookbook/slackbot/Dockerfile.slackbot . \
--no-cache \
--tag us-docker.pkg.dev/prefect-prd-internal-tools/marvin/marvin-internal-bot:latest \
--tag us-docker.pkg.dev/prefect-prd-internal-tools/marvin/marvin-internal-bot:${SHORT_SHA} \
- name: Push image to prefect-prd-internal-tools
run: docker push --all-tags us-docker.pkg.dev/prefect-prd-internal-tools/marvin/marvin-internal-bot
- name: Trigger cloudrun revision deploy workflow
run: |
gh workflow run deploy-cloudrun-revision-internal.yaml \
--ref main
env:
GITHUB_TOKEN: ${{ github.token }}