Skip to content

Commit

Permalink
migrate from travis to github actions and remove docker
Browse files Browse the repository at this point in the history
  • Loading branch information
pete911 committed Sep 10, 2021
1 parent 85f4833 commit 7f3748c
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 97 deletions.
3 changes: 0 additions & 3 deletions .dockerignore

This file was deleted.

5 changes: 0 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,3 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: goreleaser

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
-
name: Run tests
run: make test
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/ipcalc
/ipcalc
/releases/*
37 changes: 37 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
builds:
-
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ldflags:
- -X main.Version={{.Version}}
checksum:
name_template: 'checksums.txt'
dist: releases
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
release:
github:
owner: pete911
name: ipcalc
brews:
- tap:
owner: pete911
name: homebrew-tap
token: "{{ .Env.GITHUB_TOKEN }}"
name: ipcalc
homepage: "https://github.com/pete911/ipcalc"
description: "IP calculator"
folder: Formula
install: |
bin.install "ipcalc"
test: |
assert_match /version/, shell_output("#{bin}/ipcalc", 0)
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

29 changes: 3 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
NAME := ipcalc
IMAGE := pete911/${NAME}
VERSION ?= dev

test:
Expand All @@ -10,27 +8,6 @@ build: test
go build -ldflags "-X main.Version=${VERSION}"
.PHONY:build

image:
docker build --build-arg version=${VERSION} -t ${IMAGE}:${VERSION} .
docker tag ${IMAGE}:${VERSION} ${IMAGE}:latest
.PHONY:image

push-image:
docker push ${IMAGE}:${VERSION}
docker push ${IMAGE}:latest
.PHONY:push-image

release:
# amd64
for GOOS in "linux" "darwin" "windows"; do \
BUILD_CMD="GOOS=$$GOOS GOARCH=amd64 go build -ldflags \"-X main.Version=${VERSION}\" -o releases/${NAME}" ; \
TAR_CMD="tar -czvf releases/${NAME}_$${GOOS}_amd64.tar.gz -C releases/ ${NAME} && rm releases/${NAME}" ; \
docker run --rm -it -v "${PWD}":/usr/src/app -w /usr/src/app -e CGO_ENABLED=0 golang:1.16-alpine sh -c "$$BUILD_CMD && $$TAR_CMD" ; \
done
# arm64
for GOOS in "darwin"; do \
BUILD_CMD="GOOS=$$GOOS GOARCH=arm64 go build -ldflags \"-X main.Version=${VERSION}\" -o releases/${NAME}" ; \
TAR_CMD="tar -czvf releases/${NAME}_$${GOOS}_arm64.tar.gz -C releases/ ${NAME} && rm releases/${NAME}" ; \
docker run --rm -it -v "${PWD}":/usr/src/app -w /usr/src/app -e CGO_ENABLED=0 golang:1.16-alpine sh -c "$$BUILD_CMD && $$TAR_CMD" ; \
done
.PHONY:release
install: test
go install -ldflags "-X main.Version=${VERSION}"
.PHONY:install
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![Build Status](https://travis-ci.com/pete911/ipcalc.svg?branch=main)](https://travis-ci.com/pete911/ipcalc)

# ipcalc

Go implementation of ipcalc command.
Expand All @@ -11,7 +9,24 @@ Go implementation of ipcalc command.
## download

- [binary](https://github.com/pete911/ipcalc/releases)
- [docker](https://hub.docker.com/repository/docker/pete911/ipcalc)

## build/install

### brew

- add tap `brew tap pete911/tap`
- install `brew install ipcalc`

### go

[go](https://golang.org/dl/) has to be installed.
- build `make build`
- install `make install`

## release

Releases are published when the new tag is created e.g.
`git tag -m "add super cool feature" v1.0.0 && git push --follow-tags`

## run

Expand Down
1 change: 0 additions & 1 deletion releases/README.md

This file was deleted.

0 comments on commit 7f3748c

Please sign in to comment.