-
Notifications
You must be signed in to change notification settings - Fork 4
/
action.yml
61 lines (59 loc) 路 1.8 KB
/
action.yml
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
name: "Publish docker image"
description: "Publish docker image action"
inputs:
workload-identity-provider:
required: true
description: "Workload identity provider"
service-account-email:
required: true
description: "Service account email"
bot-token:
required: true
description: "secrets.BOT_TOKEN"
git-ref:
description: "Git tag/commit"
required: true
go-version:
description: "Go version"
required: true
main-go-path:
description: "Path to main.go file"
required: true
docker-repo:
description: "Docker repo"
required: true
docker-image-tag:
description: "Tag for docker image"
required: true
runs:
using: "composite"
steps:
- name: "Setup Go"
uses: actions/setup-go@v3
with:
go-version: ${{ inputs.go-version }}
- name: "Checkout source code"
uses: actions/checkout@v3
with:
ref: ${{ inputs.git-ref }}
- name: "Configure Go modules"
shell: bash
run: git config --global url."https://${{ inputs.bot-token }}:@github.com/org/".insteadOf "https://github.com/org/"
- name: "Setup ko"
uses: imjasonh/setup-ko@v0.6
- name: "Authenticate to Google Cloud"
uses: google-github-actions/auth@v1
with:
token_format: access_token
workload_identity_provider: ${{ inputs.workload-identity-provider }}
service_account: ${{ inputs.service-account-email }}
- name: "Set up Cloud SDK"
uses: google-github-actions/setup-gcloud@v0
- run: gcloud auth configure-docker
shell: bash
- name: "Publish docker image"
shell: bash
env:
KO_DOCKER_REPO: ${{ inputs.docker-repo }}
TAG: ${{ inputs.docker-image-tag }}
run: cd ${{ inputs.main-go-path }} && ko publish main.go --tags ${{ inputs.docker-image-tag }} -B