Skip to content

Commit

Permalink
release: automate with GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Mar 2, 2020
1 parent c84cc82 commit a189198
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 469 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
push:
tags:
- 'v*'
name: GoReleaser
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch origin +refs/tags/*:refs/tags/*
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.14.x
- name: Install Docker credentials
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker login -u qubot -p ${{ secrets.GITHUB_TOKEN }} docker.pkg.github.com
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release
env:
GITHUB_TOKEN: ${{ secrets.QUBOT_GITHUB_TOKEN }}
if: success()
18 changes: 8 additions & 10 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
project_name: amflow

before:
hooks:
- make clean
- make deps
- make prebuild

builds:
- ldflags:
- -s -w -X github.com/artefactual-labs/amflow/internal/version.version={{.Version}}
env:
- CGO_ENABLED=0
goos:
- darwin
- windows
- linux
goarch:
- amd64
archive:
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
format: binary
flags:
- -trimpath

checksum:
name_template: "{{ .ProjectName }}-checksums.txt"
nfpm:
formats:
- deb
dependencies:
- graphviz

dockers:
- goos: linux
goarch: amd64
image_templates:
- "artefactual/amflow:latest"
- "artefactual/amflow:v{{ .Major }}"
- "docker.pkg.github.com/artefactual-labs/amflow/amflow:latest"
- "docker.pkg.github.com/artefactual-labs/amflow/amflow:v{{ .Major }}"
dockerfile: Dockerfile.release
build_flag_templates:
- "--label=org.label-schema.schema-version=1.0"
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ COPY ./ui ./ui
RUN yarn --cwd /src/ui install
RUN yarn --cwd /src/ui build

ARG GO_VERSION=1.11
ARG GO_VERSION=1.14
FROM golang:${GO_VERSION}-alpine AS build
RUN apk add --no-cache ca-certificates git make
WORKDIR /src
Expand All @@ -13,7 +13,7 @@ RUN make deps
COPY ./ ./
RUN make build

FROM alpine:3.8 AS final
FROM alpine:3.11 AS final
RUN apk --no-cache add ca-certificates graphviz
COPY --from=build /tmp/amflow /bin/amflow
ENTRYPOINT ["/amflow"]
2 changes: 1 addition & 1 deletion Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is used by GoReleaser.
FROM alpine:3.8 AS final
FROM alpine:3.11 AS final
RUN apk --no-cache add ca-certificates graphviz
COPY amflow /
ENTRYPOINT ["/amflow"]
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
GOPATH=$(shell go env GOPATH)
GOBIN=$(GOPATH)/bin
GOCMD=go
export PATH:=$(GOBIN):$(PATH)

# We don't need make's built-in rules.
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:
Expand All @@ -11,16 +16,13 @@ help:
@echo " check check all the things"
@echo " help this help message"

TOOLS= \
github.com/goadesign/goa/goagen \
github.com/gobuffalo/packr/v2/packr2
tools:
env GO111MODULE=off go get github.com/gobuffalo/packr/v2/packr2

.PHONY: deps
deps:
deps: tools
@echo "Downloading modules..."
go mod download
@echo "Installing tools..."
CGO_ENABLED=0 go install $(TOOLS)

.PHONY: goagen
goagen:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ Serve the latest workflow document found in Archivematica's GitHub repository. I

$ docker run -p 2323:2323 --rm artefactual/amflow:latest edit --latest

## API docs
It is also possible to point to a local or remote workflow document, e.g.:

$ docker run -p 2323:2323 --rm artefactual/amflow:latest edit --file=https://raw.githubusercontent.com/artefactual/archivematica/stable/1.10.x/src/MCPServer/lib/assets/workflow.json

See http://petstore.swagger.io/?url=https://raw.githubusercontent.com/artefactual-labs/amflow/main/public/swagger/swagger.yaml.

[0]: https://github.com/artefactual-labs/amflow/releases/latest
[1]: https://hub.docker.com/r/artefactual/amflow/tags
10 changes: 2 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,28 @@ require (
github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 // indirect
github.com/dimfeld/httptreemux v5.0.1+incompatible // indirect
github.com/goadesign/goa v1.0.1-0.20181221201017-4a2fb392efda
github.com/gobuffalo/depgen v0.0.0-20190315124901-e02f65b90669 // indirect
github.com/gobuffalo/events v1.2.0 // indirect
github.com/gobuffalo/meta v0.0.0-20190126124307-c8fb6f4eb5a9 // indirect
github.com/gobuffalo/packr/v2 v2.7.1
github.com/google/gxui v0.0.0-20151028112939-f85e0a97b3a4 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/go-uuid v1.0.1 // indirect
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/kr/pty v1.1.4 // indirect
github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d // indirect
github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b // indirect
github.com/markbates/deplist v1.0.5 // indirect
github.com/olekukonko/tablewriter v0.0.4
github.com/onsi/ginkgo v1.7.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c // indirect
github.com/pkg/errors v0.9.1
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
github.com/sirupsen/logrus v1.4.2
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 // indirect
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
github.com/spf13/afero v1.2.2
github.com/spf13/cobra v0.0.6
github.com/stretchr/testify v1.5.1
github.com/zach-klippenstein/goregen v0.0.0-20160303162051-795b5e3961ea // indirect
go.uber.org/multierr v1.5.0
golang.org/x/exp v0.0.0-20190316020145-860388717186 // indirect
golang.org/x/mobile v0.0.0-20190318164015-6bd122906c08 // indirect
gonum.org/v1/gonum v0.7.0
gonum.org/v1/netlib v0.0.0-20190314102120-fc220b4194ca // indirect
)
Loading

0 comments on commit a189198

Please sign in to comment.