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

Implement GitHub actions #469

Merged
merged 15 commits into from
Nov 23, 2020
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
27 changes: 17 additions & 10 deletions .github/workflows/go.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ name: Build

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

jobs:

build:
name: Build
runs-on: ubuntu-latest

steps:

- name: Setup
Expand All @@ -22,24 +25,28 @@ jobs:
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-go-

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Tools
run: make install

- name: UI
run: make ui
# https://github.com/streamlink/streamlink/pull/2932
# https://github.com/actions/checkout/issues/217#issuecomment-636481619
# - name: Fetch tags
# # run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
# run: git fetch

- name: Install tools
run: make install

- name: Assets
- name: Assets & UI
run: make assets

- name: Clean
- name: Porcelain
run: |
go mod tidy
test -z "$(git status --porcelain)" || (git status; git diff; false)
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
name: Docker

on:
push:
branches: [ master ]
# push:
# branches:
# - actions
workflow_run:
workflows:
- Build
types:
- completed
branches:
- actions

jobs:

build:

docker:
name: Docker
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install
run: curl -sfL https://raw.githubusercontent.com/ldez/seihon/master/godownloader.sh | sudo bash -s -- -b $GOPATH/bin v0.5.1

- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }}

- name: Build
run: make publish-latest
41 changes: 0 additions & 41 deletions .github/workflows/goreleaser.yml

This file was deleted.

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

on:
workflow_run:
workflows:
- Build
types:
- completed
branches:
- actions
# tags:
# - '*'

jobs:

release:
runs-on: ubuntu-latest

steps:
# - name: Setup
# uses: actions/setup-go@v2
# with:
# go-version: 1.14

# - uses: actions/cache@v2
# with:
# path: ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# restore-keys: |
# ${{ runner.os }}-go-

# - name: Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0

# - name: Tools
# run: make install

# - name: UI
# run: make ui

- name: GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ IMAGE := andig/evcc
ALPINE := 3.12
TARGETS := arm.v6,arm.v8,amd64

default: clean install ui assets lint test build
default: clean install assets lint test build

clean:
rm -rf dist/
Expand All @@ -32,6 +32,7 @@ ui:

assets:
@echo "Generating embedded assets"
npm run build
go generate ./...

build:
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ require (
gopkg.in/ini.v1 v1.62.0
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
)

replace github.com/spf13/viper => github.com/andig/viper v1.6.3-0.20201123175942-a5af09afab5b
Loading