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

First release #1

Merged
merged 5 commits into from
Mar 20, 2022
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
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git/
.github/
.gitignore
Dockerfile
LICENSE
README.md
29 changes: 29 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Summary

Summary of the PR here. The GitHub release description is created from this comment so keep it nice and descriptive.

Remember to remove sections that you don't need or use.

### Added

- Describe the added features

### Changed

- Describe the outwards facing code change

### Fixed

- Describe the fix and the bug

### Removed

- Describe what was removed and why

### Security

- Describe the security issue and the fix

### Deprecated

- Describe the part of the code being deprecated and why
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on:
push:
branches:
- '**'

jobs:
build:
name: Build + Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Build
run: go build .
- name: Test
run: go test -v ./...
docker:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- name: Build Docker image
uses: docker/build-push-action@v2
with:
push: false
platforms: linux/amd64,linux/arm64
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release

env:
PRERELEASE_BRANCHES:

on:
pull_request:
types: [closed]

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Establish context
id: context
uses: dolittle/establish-context-action@v2
with:
prerelease-branches: ${{ env.PRERELEASE_BRANCHES }}
- name: Increment version
id: increment-version
if: ${{ steps.context.outputs.should-publish == 'true' }}
uses: dolittle/increment-version-action@v2
with:
version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}
- name: Prepend to Changelog
if: ${{ steps.context.outputs.should-publish == 'true' && steps.context.outputs.release-type != 'prerelease' }}
uses: dolittle/add-to-changelog-action@v2
with:
version: ${{ steps.increment-version.outputs.next-version }}
body: ${{ steps.context.outputs.pr-body }}
pr-url: ${{ steps.context.outputs.pr-url }}
changelog-path: CHANGELOG.md
user-email: [email protected]
user-name: dolittle-build
- name: Create GitHub Release
id: create-release
uses: dolittle/github-release-action@v2
if: ${{ steps.context.outputs.should-publish == 'true' }}
with:
token: ${{ secrets.BUILD_PAT }}
version: ${{ steps.increment-version.outputs.next-version }}
body: ${{ steps.context.outputs.pr-body }}
- name: Push Docker image to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
tags: dolittle/contracts-compatibility:${{ steps.increment-version.outputs.next-version }}
- name: Push Latest tag of Docker image to Docker Hub
uses: docker/build-push-action@v2
if: ${{ steps.context.outputs.release-type != 'prerelease' }}
with:
push: true
platforms: linux/amd64,linux/arm64
tags: dolittle/contracts-compatibility:latest
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM --platform=$BUILDPLATFORM golang:1.18.0 as build
ARG TARGETARCH

WORKDIR /go/src/contracts-compatibility
COPY . /go/src/contracts-compatibility
ENV CGO_ENABLED=0
ENV GOARCH $TARGETARCH
RUN go build -o /go/bin/contracts-compatibility .

FROM gcr.io/distroless/static-debian11
COPY --from=build /go/bin/contracts-compatibility /bin/contracts-compatibility
ENTRYPOINT ["/bin/contracts-compatibility"]