-
Notifications
You must be signed in to change notification settings - Fork 8
91 lines (84 loc) · 2.22 KB
/
latest.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
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
schedule:
- cron: '0 0 * * *'
name: build-test-publish
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- run: go env
- name: go build
run: go build -v ./...
- name: go test
run: go test -v ./...
e2e:
name: e2e tests
runs-on: ubuntu-latest
needs: [ build ]
env:
KO_DOCKER_REPO: registry.local:5000/knative
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.21
- uses: imjasonh/setup-ko@v0.7
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- name: install manual-approval-gate custom task
run: |
chmod +x test/e2e-test.sh
./test/e2e-test.sh
publish:
name: publish latest
runs-on: ubuntu-latest
needs: [ build ]
# https://docs.github.com/en/actions/reference/authentication-in-a-workflow
permissions:
id-token: write
packages: write
contents: read
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.21
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: imjasonh/setup-ko@v0.7
- run: |
ko publish --platform=linux/amd64,linux/s390x,linux/ppc64le,linux/arm64 --push=${{ github.event_name != 'pull_request' }} --base-import-paths ./cmd/controller