-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from nytimes/github-actions
Setup Github Actions
- Loading branch information
Showing
5 changed files
with
88 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |