Skip to content

Commit

Permalink
Add support for running base16-builder-go as a GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
belak committed Jun 21, 2022
1 parent 63055ec commit 1a383d6
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 756 deletions.
1 change: 1 addition & 0 deletions .dockerignore
@@ -0,0 +1 @@
dist
3 changes: 0 additions & 3 deletions .gitignore
Expand Up @@ -24,9 +24,6 @@ _testmain.go
*.prof

# Builder related things
sources
schemes
templates
base16-builder-go

dist/
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "schemes"]
path = schemes
url = https://github.com/base16-project/base16-schemes.git
1 change: 1 addition & 0 deletions .goreleaser.yaml
@@ -1,3 +1,4 @@
project_name: base16-builder-go
builds:
- env:
- CGO_ENABLED=0
Expand Down
27 changes: 27 additions & 0 deletions Dockerfile
@@ -0,0 +1,27 @@
# Stage 1: Build the application
FROM golang:1.18 as builder

RUN go install github.com/goreleaser/goreleaser@v1.9.2

RUN mkdir /build

WORKDIR /src/base16-builder-go

ADD ./go.mod ./go.sum ./
RUN go mod download

ADD . ./
RUN git clone https://github.com/base16-project/base16-schemes.git schemes
RUN goreleaser build --single-target --snapshot --rm-dist -o /build/base16-builder-go

RUN ls /build

# Stage 2: Copy files and configure what we need
FROM debian:buster-slim

ADD entrypoint.sh /bin

# Copy the built binary into the container
COPY --from=builder /build /bin

ENTRYPOINT ["/bin/entrypoint.sh"]
10 changes: 10 additions & 0 deletions action.yml
@@ -0,0 +1,10 @@
name: 'Base16 Builder Go'
description: 'Build all the schemes for a template repo'
inputs:
path:
description: 'path to the schemes to use to build'
required: true
default: schemes
runs:
using: 'docker'
image: 'Dockerfile'
9 changes: 9 additions & 0 deletions entrypoint.sh
@@ -0,0 +1,9 @@
#!/bin/bash

ARGS=""

if [[ -n $INPUT_PATH ]]; then
ARGS+="-schemes-dir $INPUT_PATH"
fi

/bin/base16-builder-go $ARGS
11 changes: 7 additions & 4 deletions go.mod
@@ -1,14 +1,17 @@
module github.com/belak/base16-builder-go

go 1.16
go 1.18

require (
github.com/cbroglie/mustache v1.3.1
github.com/sirupsen/logrus v1.8.1
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.1 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.0
)
753 changes: 4 additions & 749 deletions go.sum

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions schemes
Submodule schemes added at 0a6b24

0 comments on commit 1a383d6

Please sign in to comment.