Skip to content

Commit c60c868

Browse files
committed
Automatic releases via Github Actions & goreleaser
From now on it should keep the docker image up to date with the latest changes in master and do automatic releases into Github based on tags. Small changes to the README
1 parent 953c3da commit c60c868

File tree

7 files changed

+176
-2
lines changed

7 files changed

+176
-2
lines changed

.github/stale.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 10
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 5
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- pinned
8+
- security
9+
- enhancement
10+
# Label to use when marking an issue as stale
11+
staleLabel: stale
12+
# Comment to post when marking an issue as stale. Set to `false` to disable
13+
markComment: >
14+
This issue has been automatically marked as stale because it has not had
15+
recent activity. It will be closed if no further activity occurs. Thank you
16+
for your contributions.
17+
# Comment to post when closing a stale issue. Set to `false` to disable
18+
closeComment: false

.github/workflows/dockerpush.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
# Publish `master` as Docker `latest` image.
6+
branches:
7+
- master
8+
9+
# Publish `v1.2.3` tags as releases.
10+
tags:
11+
- v*
12+
# Run tests for any PRs.
13+
# pull_request:
14+
env:
15+
# TODO: Change variable to your image's name.
16+
IMAGE_NAME: jorgelbg/cloudflare-access-grafana
17+
18+
jobs:
19+
# Run tests.
20+
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
21+
# test:
22+
# runs-on: ubuntu-latest
23+
24+
# steps:
25+
# - uses: actions/checkout@v2
26+
27+
# - name: Run tests
28+
# run: |
29+
# if [ -f docker-compose.test.yml ]; then
30+
# docker-compose --file docker-compose.test.yml build
31+
# docker-compose --file docker-compose.test.yml run sut
32+
# else
33+
# docker build . --file Dockerfile
34+
# fi
35+
36+
# Push image to GitHub Package Registry.
37+
# See also https://docs.docker.com/docker-hub/builds/
38+
push:
39+
# Ensure test job passes before pushing image.
40+
# needs: test
41+
if: "!contains(github.event.head_commit.message, 'skip ci')"
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
- uses: actions/checkout@v2
46+
47+
- name: Build image
48+
run: docker build --build-arg MOD=readonly . --file Dockerfile --tag image
49+
50+
- name: Log into registry
51+
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u ${{ github.actor }} --password-stdin
52+
53+
- name: Push image
54+
run: |
55+
# Strip git ref prefix from version
56+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
57+
58+
# Strip "v" prefix from tag name
59+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
60+
61+
# Use Docker `latest` tag convention
62+
[ "$VERSION" == "master" ] && VERSION=latest
63+
64+
echo IMAGE_NAME=$IMAGE_NAME
65+
echo VERSION=$VERSION
66+
67+
docker tag image $IMAGE_NAME:$VERSION
68+
docker push $IMAGE_NAME:$VERSION
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
pull_request:
7+
jobs:
8+
golangci:
9+
name: lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: golangci-lint
14+
uses: golangci/golangci-lint-action@v1
15+
with:
16+
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
17+
version: v1.27
18+
19+
# Optional: working directory, useful for monorepos
20+
# working-directory: somedir
21+
22+
# Optional: golangci-lint command line arguments.
23+
# args: --issues-exit-code=0
24+
25+
# Optional: show only new issues if it's a pull request. The default value is `false`.
26+
# only-new-issues: true

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: goreleaser
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: Run GoReleaser
25+
uses: goreleaser/goreleaser-action@v1
26+
with:
27+
args: release --rm-dist
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@
2020

2121
# Dependency directories (remove the comment below to include it)
2222
# vendor/
23+
dist/
24+
.DS_Store

.goreleaser.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
project_name: cloudflare-access-grafana
2+
3+
before:
4+
hooks:
5+
- go mod download
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
main: ./main.go
11+
12+
archives:
13+
- replacements:
14+
# darwin: Darwin
15+
# linux: Linux
16+
# windows: Windows
17+
386: i386
18+
amd64: x86_64
19+
20+
checksum:
21+
name_template: 'checksums.txt'
22+
23+
snapshot:
24+
name_template: "{{ .Tag }}-next"
25+
26+
changelog:
27+
sort: asc
28+
filters:
29+
exclude:
30+
- '^docs:'
31+
- '^test:'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![Docker pulls](https://badgen.net/docker/pulls/jorgelbg/cloudflare-access-grafana?icon=docker&color=purple)
44

55
<p align="center">
6-
<img class="center" src="docs/logo.svg" width="150" alt="dissect-tester logo"/>
6+
<img class="center" src="docs/logo.svg" width="150" alt="cloudflare access grafana logo"/>
77
</p>
88

99
cloudflare-access-grafana is an HTTP proxy implemented to run as transparently behind [Cloudflare
@@ -80,7 +80,7 @@ All the configuration options are passed to cloudflare-access-proxy as environme
8080
## 👨🏻‍💻 Developing
8181

8282
```shell
83-
git clone https://github.com/jorgelbg/dissect-tester
83+
git clone https://github.com/jorgelbg/cloudflare-access-grafana
8484
cd cloudflare-access-grafana/
8585
make
8686
```

0 commit comments

Comments
 (0)