Skip to content

Commit b3838e7

Browse files
committed
Refactor code and improve changes detection
Add github actions for lint, publish, and release Update README Add documentation
1 parent c990dfd commit b3838e7

File tree

213 files changed

+1028
-262168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+1028
-262168
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ README.md
66
LICENSE
77
web-watcher
88
db.sqlite
9-
vendor
9+
dist/

.github/images/gopher.png

191 KB
Loading

.github/workflows/lint.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ubuntu-latest
11+
steps:
12+
13+
- name: Set up Go 1.14
14+
uses: actions/setup-go@v1
15+
with:
16+
go-version: 1.14
17+
id: go
18+
19+
- name: Check out code into the Go module directory
20+
uses: actions/checkout@v2
21+
22+
- name: Build
23+
run: go build -v .
24+
25+
- name: golangci-lint
26+
uses: actions-contrib/golangci-lint@v1
27+
env:
28+
GOROOT: ""

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: github pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
defaults:
9+
run:
10+
shell: bash
11+
working-directory: www
12+
13+
jobs:
14+
deploy:
15+
runs-on: ubuntu-18.04
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
submodules: true
20+
fetch-depth: 0
21+
22+
- name: Setup Hugo
23+
uses: peaceiris/actions-hugo@v2
24+
with:
25+
hugo-version: 'latest'
26+
27+
- name: Build
28+
run: hugo --minify
29+
30+
- name: Deploy
31+
uses: peaceiris/actions-gh-pages@v3
32+
with:
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
publish_dir: ./www/public

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
-
13+
name: Checkout
14+
uses: actions/checkout@v2
15+
-
16+
name: Unshallow
17+
run: git fetch --prune --unshallow
18+
-
19+
name: Set up Go
20+
uses: actions/setup-go@v1
21+
with:
22+
go-version: 1.14.x
23+
-
24+
name: Docker login
25+
uses: azure/docker-login@v1
26+
with:
27+
login-server: docker.pkg.github.com
28+
username: ${{ secrets.DOCKER_USERNAME }}
29+
password: ${{ secrets.DOCKER_PASSWORD }}
30+
-
31+
name: Run GoReleaser
32+
uses: goreleaser/goreleaser-action@v1
33+
with:
34+
version: latest
35+
args: release --rm-dist
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
1313

14+
.DS_Store
15+
1416
db.sqlite
1517
web-watcher
1618
.idea/*
19+
vendor/
20+
dist/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "www/themes/hugo-apex-theme"]
2+
path = www/themes/hugo-apex-theme
3+
url = https://github.com/caarlos0/hugo-apex-theme.git

.goreleaser.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
before:
2+
hooks:
3+
- go mod download
4+
archives:
5+
- replacements:
6+
darwin: Darwin
7+
linux: Linux
8+
windows: Windows
9+
386: i386
10+
amd64: x86_64
11+
checksum:
12+
name_template: 'checksums.txt'
13+
snapshot:
14+
name_template: "{{ .Tag }}-next"
15+
changelog:
16+
sort: asc
17+
filters:
18+
exclude:
19+
- '^docs:'
20+
- '^test:'
21+
22+
release:
23+
github:
24+
owner: shellbear
25+
name: web-watcher
26+
27+
dockers:
28+
-
29+
binaries:
30+
- web-watcher
31+
dockerfile: Dockerfile.cgo
32+
image_templates:
33+
- "docker.pkg.github.com/shellbear/web-watcher/web-watcher:{{ .Tag }}"
34+
- "docker.pkg.github.com/shellbear/web-watcher/web-watcher:latest"
35+
build_flag_templates:
36+
- "--pull"
37+
- "--label=org.opencontainers.image.created={{.Date}}"
38+
- "--label=org.opencontainers.image.name={{.ProjectName}}"
39+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
40+
- "--label=org.opencontainers.image.version={{.Version}}"
41+

Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ FROM golang:latest
33
WORKDIR /app
44

55
COPY go.mod go.sum ./
6-
76
RUN go mod download
87

98
COPY . .
9+
RUN go build -o web-watcher .
1010

11-
RUN go build -o main .
12-
13-
CMD ["./main"]
11+
ENTRYPOINT ["/app/web-watcher"]
1412

Dockerfile.cgo

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM golang:latest
2+
3+
COPY web-watcher /
4+
5+
ENTRYPOINT ["/web-watcher"]

0 commit comments

Comments
 (0)