-
Notifications
You must be signed in to change notification settings - Fork 30
78 lines (71 loc) · 2.05 KB
/
build-shell-image.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
name: Build Shell Image
on:
schedule:
- cron: '0 10 * * *' # everyday at 10am
push:
branches:
- '**'
paths:
- 'docker/shell/**'
- '.github/workflows/build-shell-image.yaml'
pull_request:
branches:
- main
paths:
- 'docker/shell/**'
- '.github/workflows/build-shell-image.yaml'
jobs:
build_and_push_shell_image:
name: Build and Push Shell Image
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docker/shell
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- name: Authenicate to Google Cloud
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
- name: Setup Google Cloud SDK
id: auth
uses: google-github-actions/setup-gcloud@v0
with:
project_id: kots-field-labs
- name: Registry Login
uses: docker/login-action@v2
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
- name: Prepare Docker Metadata
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
gcr.io/kots-field-labs/shell
# generate Docker tags based on the following events/attributes
tags: |
type=edge,branch=main
type=edge,branch=instruqt
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and Push to Google Container Registry
uses: docker/build-push-action@v3
with:
context: docker/shell
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}