-
Notifications
You must be signed in to change notification settings - Fork 1
146 lines (127 loc) · 4.59 KB
/
release.yaml
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
137
138
139
140
141
142
143
144
145
146
---
name: Release
on:
push:
branches:
- main
workflow_call:
secrets:
ADFINISBOT_PAT:
required: true
jobs:
semrel:
permissions:
actions: none
checks: none
contents: none
deployments: none
issues: none
packages: write
pull-requests: none
repository-projects: none
security-events: none
statuses: none
id-token: write # needed for signing the images with GitHub OIDC using cosign
name: Semantic Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.ADFINISBOT_PAT }}
- name: Semantic Release
uses: go-semantic-release/action@v1
id: semrel
with:
github-token: ${{ secrets.ADFINISBOT_PAT }}
allow-initial-development-versions: true
- name: Adjust Versions
if: steps.semrel.outputs.version != ''
run: |
sed -r 's/"(0.0.0|latest)"/"${{ steps.semrel.outputs.version }}"/g' -i ./ember/package.json ./api/pyproject.toml ./charts/outdated/Chart.yaml
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: steps.semrel.outputs.version != ''
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
if: steps.semrel.outputs.version != ''
uses: docker/setup-buildx-action@v3
- name: Build and Push API Docker Image
if: steps.semrel.outputs.version != ''
uses: docker/build-push-action@v5
id: docker-api
with:
context: ./api/
target: prod
push: true
tags: |
ghcr.io/${{ github.repository }}/api:${{ steps.semrel.outputs.version }}
ghcr.io/${{ github.repository }}/api:latest
- name: Build and Push Ember Docker Image
if: steps.semrel.outputs.version != ''
uses: docker/build-push-action@v5
id: docker-ember
with:
context: ./ember/
push: true
tags: |
ghcr.io/${{ github.repository }}/ember:${{ steps.semrel.outputs.version }}
ghcr.io/${{ github.repository }}/ember:latest
- name: Run Trivy vulnerability scanner on api
if: steps.semrel.outputs.version != ''
uses: aquasecurity/[email protected]
with:
image-ref: ghcr.io/${{ github.repository }}/api
format: "cyclonedx"
output: "api.cdx"
- name: Run Trivy vulnerability scanner on ember
if: steps.semrel.outputs.version != ''
uses: aquasecurity/[email protected]
with:
image-ref: ghcr.io/${{ github.repository }}/ember
format: "cyclonedx"
output: "ember.cdx"
- name: Install Cosign
if: steps.semrel.outputs.version != ''
uses: sigstore/[email protected]
- name: Sign the images with GitHub OIDC Token using cosign
if: steps.semrel.outputs.version != ''
run: |
cosign sign --yes ghcr.io/${{ github.repository }}/api@${{ steps.docker-api.outputs.digest }}
cosign sign --yes ghcr.io/${{ github.repository }}/ember@${{ steps.docker-ember.outputs.digest }}
- name: Attach an SBOM attestation to the signed images
if: steps.semrel.outputs.version != ''
run: |
cosign attest --yes --type cyclonedx --predicate api.cdx ghcr.io/${{ github.repository }}/api@${{ steps.docker-api.outputs.digest }}
cosign attest --yes --type cyclonedx --predicate ember.cdx ghcr.io/${{ github.repository }}/ember@${{ steps.docker-ember.outputs.digest }}
- name: Set up Helm
if: steps.semrel.outputs.version != ''
uses: azure/[email protected]
with:
version: v3.14.0
- name: Package Chart
if: steps.semrel.outputs.version != ''
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm dependency build charts/outdated
helm package --destination=dist charts/outdated
- name: Push Chart
if: steps.semrel.outputs.version != ''
run: helm push dist/*.tgz oci://ghcr.io/${{ github.repository }}/helm
trivy-scan-api:
if: always()
needs: semrel
uses: ./.github/workflows/trivy-scan.yaml
with:
image-ref: api
attest: ${{ needs.semrel.result == 'success' }}
trivy-scan-ember:
if: always()
needs: semrel
uses: ./.github/workflows/trivy-scan.yaml
with:
image-ref: ember
attest: ${{ needs.semrel.result == 'success' }}