Skip to content

Commit 1684c20

Browse files
authored
Merge pull request #10 from drone/Andrew-Hayes-GCR-action
Create GCR workflow
2 parents 8eae1b2 + dec535e commit 1684c20

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

.github/workflows/gcr.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This workflow will build a docker container, publish it to Google Container Registry,
2+
3+
name: Build and Save to GCR
4+
5+
on:
6+
release:
7+
types: [created]
8+
9+
env:
10+
PROJECT_ID: ${{ secrets.GCR_PROJECT }}
11+
IMAGE: ${{ secrets.GCR_IMAGE }}
12+
13+
jobs:
14+
setup-build-publish:
15+
name: Setup, Build, and Publish
16+
runs-on: ubuntu-latest
17+
environment: production
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
# Setup gcloud CLI
24+
- uses: google-github-actions/[email protected]
25+
with:
26+
service_account_key: ${{ secrets.GCR_KEY }}
27+
project_id: ${{ secrets.GCR_PROJECT }}
28+
29+
# Configure Docker to use the gcloud command-line tool as a credential
30+
# helper for authentication
31+
- run: |-
32+
gcloud --quiet auth configure-docker
33+
34+
# Build the Docker image
35+
- name: Build
36+
run: make build-test-wrapper
37+
38+
# Push the Docker image to Google Container Registry
39+
- name: Publish
40+
run: |-
41+
docker tag "us.gcr.io/$PROJECT_ID/$IMAGE:latest" "us.gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA"
42+
docker push "us.gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA"
43+

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ clean:
2525
test:
2626
go test -race -v --cover ./...
2727

28+
build-test-wrapper:
29+
$(MAKE) -C test_wrapper build
2830

2931
# Format go code and error if any changes are made
3032
PHONY+= format

test_wrapper/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
install:
24
go get github.com/deepmap/oapi-codegen/cmd/[email protected]
35

@@ -7,4 +9,4 @@ generate:
79
oapi-codegen -generate types -package=restapi ./test_wrapper_openapi/sdk_wrapper-v1.yaml > ./restapi/test_wrapper_types.gen.go
810

911
build:
10-
docker build -t go_sdk_wrapper:latest -f ./docker/Dockerfile .
12+
docker build -t us.gcr.io/${PROJECT_ID}/${IMAGE}:latest -f ./docker/Dockerfile .

test_wrapper/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func main() {
2828
viper.SetDefault("BaseURL", "http://localhost/api/1.0")
2929

3030
viper.SetDefault("SdkKey", "1bca46aa-0abe-4b22-a5f0-904422db288b")
31-
viper.SetDefault("EnableStreaming", false)
31+
viper.SetDefault("EnableStreaming", true)
3232
viper.BindEnv("WrapperHostname", "WRAPPER_HOSTNAME")
3333
viper.BindEnv("WrapperPort", "WRAPPER_PORT")
3434
viper.BindEnv("BaseURL", "SDK_BASE_URL")

0 commit comments

Comments
 (0)