Skip to content
This repository was archived by the owner on Apr 23, 2024. It is now read-only.

Commit dac90f0

Browse files
committed
ci: add release workflow
1 parent 6e68683 commit dac90f0

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
pull_request:
7+
branches:
8+
- '**'
9+
10+
jobs:
11+
lint:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: golangci-lint
17+
run: |
18+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s
19+
./bin/golangci-lint run -v
20+
21+
build:
22+
name: Build and Run
23+
runs-on: ${{ matrix.os }}
24+
needs: lint
25+
strategy:
26+
fail-fast: true
27+
matrix:
28+
os: [macos-latest, windows-latest, ubuntu-latest]
29+
steps:
30+
- uses: actions/setup-go@v2
31+
with:
32+
go-version: 1.15
33+
- uses: actions/checkout@v2
34+
- run: go build .
35+
env:
36+
CGO_ENABLED: 0
37+
- run: go test -v ./...
38+
39+
release:
40+
name: Release
41+
runs-on: ubuntu-latest
42+
needs: build
43+
steps:
44+
- uses: actions/setup-go@v2
45+
with:
46+
go-version: 1.15
47+
- run: |
48+
go get github.com/mitchellh/gox
49+
go get github.com/tcnksm/ghr
50+
- uses: actions/checkout@v2
51+
- uses: go-semantic-release/action@v1
52+
id: semrel
53+
with:
54+
github-token: ${{ secrets.GITHUB_TOKEN }}
55+
- run: |
56+
gox -parallel 4 -osarch="linux/amd64 darwin/amd64 linux/arm windows/amd64" -ldflags="-extldflags '-static' -s -w -X github.com/saitho/git-file-webserver/main.VERSION=${{steps.semrel.outputs.version}}" -output="bin/{{.Dir}}_v${{steps.semrel.outputs.version}}_{{.OS}}_{{.Arch}}" .
57+
cd bin/ && shasum -a 256 * > ./git-file-webserver_v${{steps.semrel.outputs.version}}_checksums.txt && cd -
58+
if: steps.semrel.outputs.version != ''
59+
env:
60+
CGO_ENABLED: 0
61+
- run: ghr v${{ steps.semrel.outputs.version }} bin/
62+
if: steps.semrel.outputs.version != ''
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.semrelrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"plugins": {
3+
"commit-analyzer": {
4+
"name": "default"
5+
},
6+
"ci-condition": {
7+
"name": "github",
8+
"options": {
9+
"defaultBranch": "master"
10+
}
11+
},
12+
"changelog-generator": {
13+
"name": "default",
14+
"options": {
15+
"emojis": "true"
16+
}
17+
},
18+
"provider": {
19+
"name": "github"
20+
}
21+
}
22+
}

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Static Git File Server
22

3+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/go-semantic-release/semantic-release)
4+
[![CI](https://github.com/saitho/git-file-webserver/workflows/CI/badge.svg?branch=master)](https://github.com/saitho/git-file-webserver/actions?query=workflow%3ACI+branch%3Amaster)
5+
[![Go Report Card](https://goreportcard.com/badge/github.com/saitho/git-file-webserver)](https://goreportcard.com/report/github.com/saitho/git-file-webserver)
6+
37
## Features
48

59
This is binary allows serving selective content of a Git repository.

0 commit comments

Comments
 (0)