Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Github Actions #13

Merged
merged 7 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/slack-github-action@v1.23.0
# 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
Loading