Implement GitHub actions (#469)

This commit is contained in:
andig 2020-11-23 21:20:40 +01:00 • committed by GitHub
parent 505f9de0e1
commit 992db39eb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 87 additions and 285 deletions

View file

@ -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
@ -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
# 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: UI
run: make ui
- 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)

View file

@ -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

View file

@ -1,41 +0,0 @@
name: Release
on:
push:
tags:
- '*'
jobs:
goreleaser:
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: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

49
.github/workflows/release.yml vendored Normal file
View file

@ -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 }}