-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (103 loc) · 3.48 KB
/
tag.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
name: Build on Tag
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
jobs:
lint:
name: Lint files
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21.1'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
skip-cache: true
args: --timeout=30m
test:
name: Run tests
runs-on: 'ubuntu-22.04'
needs: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21.1'
- run: go test -v -cover ./...
security-checks:
runs-on: ubuntu-22.04
needs: test
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Build Baski Image
uses: drewbernetes/container-security-action@v0.0.2
if: github.event_name != 'pull_request'
id: build-and-scan-baski
with:
image-repo: "registry.hudson-viles.uk/public"
repo-username: ${{ secrets.REGISTRY_PUBLIC_USER }}
repo-password: ${{ secrets.REGISTRY_PUBLIC_PASSWORD }}
image-name: baski
image-tag: ${{ github.ref_name }}
check-severity: CRITICAL
trivyignore-from-s3: true
s3-endpoint: "https://api.s3.hudson-viles.uk/"
s3-access-key: ${{secrets.S3_ACCESS_KEY}}
s3-secret-key: ${{secrets.S3_SECRET_KEY}}
s3-bucket: "trivyignores"
s3-path: "baski"
add-latest-tag: true
publish-image: true
cosign-private-key: ${{secrets.COSIGN_KEY}}
cosign-password: ${{secrets.COSIGN_PASSWORD}}
cosign-tlog: false
dockerfile-path: docker/baski
- name: Build Baski Server Image
uses: drewbernetes/container-security-action@v0.0.2
if: github.event_name != 'pull_request'
id: build-and-scan-server
with:
image-repo: "registry.hudson-viles.uk/public"
repo-username: ${{ secrets.REGISTRY_PUBLIC_USER }}
repo-password: ${{ secrets.REGISTRY_PUBLIC_PASSWORD }}
image-name: baski-server
image-tag: ${{ github.ref_name }}
check-severity: CRITICAL
trivyignore-from-s3: true
s3-endpoint: "https://api.s3.hudson-viles.uk/"
s3-access-key: ${{secrets.S3_ACCESS_KEY}}
s3-secret-key: ${{secrets.S3_SECRET_KEY}}
s3-bucket: "trivyignores"
s3-path: "baski-server"
add-latest-tag: true
publish-image: true
cosign-private-key: ${{secrets.COSIGN_KEY}}
cosign-password: ${{secrets.COSIGN_PASSWORD}}
cosign-tlog: false
dockerfile-path: docker/server
package-and-push-charts:
runs-on: ubuntu-22.04
needs: security-checks
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: azure/setup-helm@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: install-helm
- name: Push Chart to Harbor
shell: bash
run: |
helm registry login -u ${{ secrets.REGISTRY_PUBLIC_USER }} -p ${{ secrets.REGISTRY_PUBLIC_PASSWORD }} https://registry.hudson-viles.uk
# Release the baski-server chart
helm package charts/baski-server --version ${{ github.ref_name }} --app-version ${{ github.ref_name }}
helm push baski-server-${{ github.ref_name }}.tgz oci://registry.hudson-viles.uk/public