Skip to content

Commit

Permalink
Merge pull request #13 from nytimes/github-actions
Browse files Browse the repository at this point in the history
Setup Github Actions
  • Loading branch information
brianfoshee authored Aug 17, 2023
2 parents 119b278 + de58652 commit af784fd
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 31 deletions.
18 changes: 0 additions & 18 deletions .drone.yml

This file was deleted.

67 changes: 67 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and Push Docker Image

on:
push:
branches: [ "main" ]
tags:
- '*'
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

permissions:
actions: write
checks: write
contents: write
deployments: write
id-token: write
issues: write
pull-requests: write
security-events: write
statuses: write

steps:
- uses: actions/checkout@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: nytimes/golang-gcloud-sdk
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# commenting out until we get the webhook secret
#- name: Send GitHub Action trigger data to Slack workflow
# id: slack
# uses: slackapi/[email protected]
# if: ${{ github.event_name != 'pull_request' }}
# with:
# payload: |
# {
# "text": "GitHub Actions Build Result: ${{ job.status }}\n triggered_by: ${{ github.actor }}\n job url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n commit url: ${{ github.event.head_commit.url }}"
# }
# env:
# # webhook for #dv-cdp-alerts
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
4 changes: 4 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# As Security-hardening-for-github-actions best practices, make sure any changes to "./github/workflows" are approved
# by project owners.

./github/workflows @nytimes/delivery-engineering @brianfoshee
19 changes: 8 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# ADD go
FROM golang:1.20 as golang

FROM gcr.io/google.com/cloudsdktool/cloud-sdk:slim
FROM gcr.io/google.com/cloudsdktool/cloud-sdk:443.0.0-slim

COPY --from=golang /usr/local/go/ /usr/local/go/

ENV GOROOT=/usr/local/go/
ENV PATH=$PATH:/usr/local/go/bin

ENV PATH=$PATH:/usr/local/go/bin/

# ADD make
RUN apt-get install -y make
# Verify that Go is installed
RUN go version

# ADD java + emulator + appengine
RUN apt-get install -y default-jre
RUN apt-get install -y google-cloud-sdk-datastore-emulator google-cloud-sdk-app-engine-go
# ADD make and java
RUN apt-get install -y make default-jre

RUN go version
# ADD datastore emulator and appengine
RUN apt-get install -y google-cloud-cli-datastore-emulator google-cloud-cli-app-engine-go
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# golang-gcloud-sdk
[![Build Status](https://cloud.drone.io/api/badges/nytimes/golang-gcloud-sdk/status.svg)](https://cloud.drone.io/nytimes/golang-gcloud-sdk)
[![Build Status][badge]][actions]

A simple docker image containing `gcloud`, `go` and `make`.
A simple docker image containing `gcloud`, `go` and `make`. Includes the
following `gcloud` components:

- `app-engine-go`
- `cloud-datastore-emulator`

[actions]: https://github.com/nytimes/golang-gcloud-sdk/actions
[badge]: https://github.com/nytimes/golang-gcloud-sdk/actions/workflows/build.yml/badge.svg

0 comments on commit af784fd

Please sign in to comment.