Repository navigation
136 lines (109 loc) · 3.45 KB
/
Copy pathdocker.yml
File metadata and controls
136 lines (109 loc) · 3.45 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Docker
on:
workflow_dispatch:
push:
schedule:
- cron: "0 8 * * 1"
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: gofmt
run: test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; }
- name: go vet
run: go vet -tags nodynamic ./...
- name: go test
run: go test -tags nodynamic -race ./...
- name: staticcheck
uses: dominikh/staticcheck-action@v1
with:
install-go: false
build-tags: nodynamic
# v0.8.1 (latest release) can't read go1.27.2 export data; pinned to
# a master commit verified against go1.27.2 (same as dockette/viewdoc).
version: "452d5bb86b45"
- name: govulncheck
run: go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 -tags nodynamic ./...
- name: shellcheck
run: shellcheck -S warning docshot.sh test/formats/gen.sh
- name: hadolint
run: docker run --rm -i -v "$PWD/.hadolint.yaml:/.config/hadolint.yaml:ro" hadolint/hadolint < Dockerfile
build:
name: Build
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Read VERSION
id: version
run: . ./VERSION && echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build image for testing
uses: docker/build-push-action@v7
with:
context: .
push: false
load: true
tags: dockette/docshot:test
build-args: VERSION=${{ steps.version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test image
run: make smoke test-isolation DOCKER_IMAGE=dockette/docshot:test
- name: Login to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# One build, two tags: latest and <date>
- name: Build and push
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: |
dockette/docshot:latest
dockette/docshot:${{ steps.version.outputs.version }}
platforms: linux/amd64,linux/arm64
build-args: VERSION=${{ steps.version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
release:
name: Release
needs: build
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
. ./VERSION
gh release view "$VERSION" || gh release create "$VERSION" --generate-notes
docs:
name: Docs
needs: build
if: github.ref == 'refs/heads/master'
uses: dockette/.github/.github/workflows/dockerhub-description.yml@master
secrets: inherit
with:
image: "dockette/docshot"