-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (118 loc) · 2.94 KB
/
pipeline.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Pipeline
on:
pull_request:
push:
tags:
- "v*"
workflow_dispatch:
env:
DOCKER_BUILDKIT: 1
PROJECT_DOCKER_CACHE_BACKEND: ${{ vars.PROJECT_DOCKER_CACHE_BACKEND }}
PROJECT_DOCKER_HOST: ${{ vars.PROJECT_DOCKER_HOST }}
PROJECT_DOCKER_ORG: ${{ vars.PROJECT_DOCKER_ORG }}
PROJECT_DOCKER_PLATFORMS: ${{ vars.PROJECT_DOCKER_PLATFORMS }}
PROJECT_NAME: ${{ vars.PROJECT_NAME }}
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare
uses: schubergphilis/prepare-action@v1
with:
type: container
job: lint
- name: Lint
run: |
make lint
scan:
name: Scan
runs-on: ubuntu-22.04
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare
uses: schubergphilis/prepare-action@v1
with:
type: container
job: scan
- name: Scan
run: |
make scan
pre-ci:
name: Pre-CI
runs-on: ubuntu-22.04
needs: scan
outputs:
platforms: ${{ steps.platforms.outputs.value }}
steps:
- name: Get Platforms as JSON
id: platforms
run: |
echo "value=[\"$(echo $PROJECT_DOCKER_PLATFORMS | sed 's/,/\",\"/g')\"]" >> $GITHUB_OUTPUT
ci:
name: CI
runs-on: ubuntu-22.04
needs: pre-ci
strategy:
matrix:
platforms: ${{ fromJSON(needs.pre-ci.outputs.platforms) }}
permissions:
attestations: write
contents: read
id-token: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare
uses: schubergphilis/prepare-action@v1
with:
type: container
job: ci
- name: Login to GitHub Registry
uses: docker/login-action@v3
with:
registry: ${{ vars.PROJECT_DOCKER_HOST }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
env:
PROJECT_DOCKER_PLATFORMS: ${{ matrix.platforms }}
run: |
make build
- name: Test
env:
PROJECT_DOCKER_PLATFORMS: ${{ matrix.platforms }}
run: |
make test
cd:
name: CD
runs-on: ubuntu-22.04
needs: ci
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
permissions:
attestations: write
contents: read
id-token: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare
uses: schubergphilis/prepare-action@v1
with:
type: container
job: cd
- name: Login to GitHub Registry
uses: docker/login-action@v3
with:
registry: ${{ vars.PROJECT_DOCKER_HOST }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Release
run: |
make release