Skip to content

Commit

Permalink
Switch to Go Modules and GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
hoto committed Jul 1, 2020
1 parent 1e27d96 commit be216df
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 138 deletions.
39 changes: 0 additions & 39 deletions .circleci/config.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release - github, brew

on:
push:
tags:
- '*'

jobs:
release:
name: GitHub release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
id: go

- name: Unshallow git repo
run: git fetch --prune --unshallow

- name: Run goreleaser
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
run: make goreleaser-release
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
release:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
id: go

- name: Build
run: make build

- name: Test
run: make test

- name: Dry run goreleaser
run: make goreleaser-dry-run
43 changes: 28 additions & 15 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
---
builds:
- env:
- main: ./cmd/jenkins-credentials-decryptor/main.go
env:
- CGO_ENABLED=0
main: ./cmd/jenkins-credentials-decryptor/main.go
archive:
format: binary
replacements:
darwin: Darwin
linux: Linux
386: i386
amd64: x86_64
ignore:
- goos: darwin
goarch: 386
archives:
- format: binary
replacements:
darwin: Darwin
linux: Linux
386: i386
amd64: x86_64
- id: homebrew
name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
replacements:
darwin: Darwin
linux: Linux
amd64: x86_64
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
Expand All @@ -18,9 +28,12 @@ release:
prerelease: auto
changelog:
sort: asc
filters:
exclude:
- '^Docs:'
- '^Test:'
- '^Update readme'
- '^Update readme.*'
brews:
- github:
owner: hoto
name: homebrew-repo
folder: Formula
homepage: https://github.com/hoto/jenkins-credentials-decryptor
description: Navigitae locally cloned repos.
test: |
system "#{bin}/jenkins-credentials-decryptor --version"
44 changes: 0 additions & 44 deletions Gopkg.lock

This file was deleted.

30 changes: 0 additions & 30 deletions Gopkg.toml

This file was deleted.

22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
.PHONY: clean dependencies build test all

all: clean build test
.PHONY: clean dependencies build test run install github-release github-release-dry-run goreleaser-dry-run

clean:
go clean
rm -rf bin/ dist/

dependencies:
go get -v -t -d ./...
go get -u github.com/golang/dep/cmd/dep
dep ensure
go mod download
go mod tidy
go mod verify

build: dependencies
go build -o bin/jenkins-credentials-decryptor cmd/jenkins-credentials-decryptor/main.go

test:
go test -v ./...

run: clean build
./bin/jenkins-credentials-decryptor $(arg)

install: clean build
go install -v ./...

github-release: dependencies
curl -sL https://git.io/goreleaser | bash
goreleaser-release: clean dependencies
curl -sL https://git.io/goreleaser | VERSION=v0.137.0 bash

goreleaser-dry-run: clean dependencies
curl -sL https://git.io/goreleaser | VERSION=v0.137.0 bash -s -- --skip-publish --snapshot --rm-dist

github-release-dry-run: dependencies
goreleaser-dry-run-local: dependencies
goreleaser release --skip-publish --snapshot --rm-dist
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ I've tested this on Jenkins 1.625.1 and 2.141
Download binary from [releases](https://github.com/hoto/jenkins-credentials-decryptor/releases), Linux and Mac only:

curl -L \
"https://github.com/hoto/jenkins-credentials-decryptor/releases/download/0.0.7/jenkins-credentials-decryptor_0.0.7_$(uname -s)_$(uname -m)" \
"https://github.com/hoto/jenkins-credentials-decryptor/releases/download/0.0.8/jenkins-credentials-decryptor_0.0.8_$(uname -s)_$(uname -m)" \
-o jenkins-credentials-decryptor

chmod +x jenkins-credentials-decryptor
Expand Down
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/hoto/jenkins-credentials-decryptor

go 1.14

require (
github.com/beevik/etree v1.1.0
github.com/stretchr/testify v1.6.1
)
13 changes: 13 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 comments on commit be216df

Please sign in to comment.