Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Migrating builds to GitHub Actions away from Drone Cloud #13

Merged
merged 14 commits into from
Feb 28, 2023
89 changes: 0 additions & 89 deletions .drone.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# These owners will be the default owners for everything in the repo.
# Unless a later match takes precedence, these owners
# will be requested for review when someone opens a pull request.
* @nytimes/go-developers
* @nytimes/go-developers

# Make sure any changes to GitHub Actions are approved by project owners.
.github/workflows/ @nytimes/delivery-engineering
6 changes: 2 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to drone-openapi

drone-openapi is an open source project started by handful of developers at The New York Times and open to the entire open source community.
`drone-openapi` is an open source project started by handful of developers at The New York Times and open to the entire open source community.

We really appreciate your help!

Expand All @@ -26,10 +26,8 @@ Before submitting changes, please follow these guidelines:
1. Open an issue to discuss a new feature.
1. Write tests.
1. Make sure code follows the ['Go Code Review Comments'](https://github.com/golang/go/wiki/CodeReviewComments).
<!--1. Make sure your changes pass `make test`.-->
<!--1. Make sure the entire test suite passes locally and on Travis CI.-->
1. Open a Pull Request.

## License

Unless otherwise noted, the Drone-GAE source files are distributed under the Apache 2.0-style license found in the LICENSE file.
Unless otherwise noted, `drone-openapi` is distributed under the Apache 2.0-style license found in the LICENSE file.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ updates:
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
84 changes: 84 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Go

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

env:
CGO_ENABLED: 0

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: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Test
run: |
go mod download
go test -cover -vet all

- name: Build
run: |
go build -a -ldflags "-X main.version=${GITHUB_REF_NAME} -X main.rev=${GITHUB_SHA}"

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: nytimes/drone-openapi
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
if: ${{ github.event_name != 'pull_request' }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

# dry run, don't push image for pull_request event.
- 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 }}

- name: Slack notification
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: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# drone-openapi

[![Build Status](https://cloud.drone.io/api/badges/nytimes/drone-openapi/status.svg)](https://cloud.drone.io/nytimes/drone-openapi)
[![Build Status](https://github.com/nytimes/drone-openapi/actions/workflows/build.yml/badge.svg)](https://github.com/nytimes/drone-openapi/actions/workflows/build.yaml)

Publish Open API spec files from a Drone pipeline.

## Links

- Docker Hub [release tags](https://hub.docker.com/r/nytimes/drone-openapi/tags)
- Drone.io [builds](https://cloud.drone.io/nytimes/drone-openapi)
- GitHub Actions workflow [runs](https://github.com/nytimes/drone-openapi/actions)
- Contributing [documentation](.github/CONTRIBUTING.md)

## Overview
Expand Down