This repository has been archived by the owner on Jun 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
119 lines (115 loc) · 3.62 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: ci
on:
pull_request:
push:
branches:
- '*'
tags:
- '*'
jobs:
golangci:
name: lint
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go
- name: Set up go env
run: export PATH=${PATH}:`go env GOPATH`/bin
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.5.1
with:
version: v1.33
unit-test:
name: unit-test
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go
- name: Set up go env
run: export PATH=${PATH}:`go env GOPATH`/bin
- name: unit-test
run: make test
- name: ci
run: make ci
goreleaser:
needs:
- unit-test
- golangci
name: goreleaser
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Enable experimental features for the Docker daemon and CLI
run: |
echo $'{"experimental":true,"features":{"buildkit":true}}' | sudo tee /etc/docker/daemon.json
mkdir -p ~/.docker
echo $'{"experimental": "enabled","features":{"buildkit":true}}' | sudo tee ~/.docker/config.json
sudo service docker restart
docker version
docker buildx version
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Builder instance name
run: echo ${{ steps.buildx.outputs.name }}
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Docker version information
run: |
docker version
docker buildx version
docker buildx ls
echo "~/.docker/config.json"; cat ~/.docker/config.json
echo "/etc/docker/daemon.json"; sudo cat /etc/docker/daemon.json
- name: Docker registry login
run: ./scripts/docker-login.sh
env:
INPUT_USERNAME: ${{ secrets.DOCKER_USERNAME }}
INPUT_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go
- name: Set up go env
run: export PATH=${PATH}:`go env GOPATH`/bin
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
- name: Parse semver string
if: startsWith(github.ref, 'refs/tags/')
id: semver
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ github.ref }}
version_extractor_regex: 'refs\/tags\/(.*)$'
- name: Create and publish multi-arch manifests
if: startsWith(github.ref, 'refs/tags/')
run: |
docker manifest create koshatul/traefik-acme:latest{,-amd64,-arm64v8,-armv7}
docker manifest push koshatul/traefik-acme:latest
docker manifest create koshatul/traefik-acme:v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}{,-amd64,-arm64v8,-armv7}
docker manifest push koshatul/traefik-acme:v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}