-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (66 loc) · 2.65 KB
/
ci.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
name: compage-template-dotnet-ci
on:
push:
branches:
- main
jobs:
build-and-push:
permissions:
id-token: write # Required for keyless signing
contents: read
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
GH_URL: https://github.com
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- name: Create JSON file
run: |
cat <<EOF > /tmp/annotations.json
{
"\$manifest": {
"org.opencontainers.image.authors": "${{ github.actor }}",
"org.opencontainers.image.url": "${{ env.REGISTRY }}/${{ github.repository }}",
"org.opencontainers.image.source": "https://github.com/intelops/compage-template-dotnet",
"org.opencontainers.image.version": "${{ github.run_id }}",
"org.opencontainers.image.vendor": "Intelops Inc.",
"org.opencontainers.image.licenses": "Apache License Version 2.0",
"org.opencontainers.image.title": "compage-template-dotnet",
"org.opencontainers.image.description": "The compage-template-dotnet template has templates for Dotnet"
}
}
EOF
- uses: oras-project/setup-oras@v1
with:
version: 1.1.0
- run: |
oras push --annotation-file /tmp/annotations.json ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }} ./:application/vnd.compage.template.go.layer.v1+tar
- name: Install Cosign
uses: sigstore/[email protected]
- name: Check install!
run: cosign version
- name: Sign the images
run: |
cosign sign -y ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }}
env:
COSIGN_EXPERIMENTAL: 1
- name: Verify the pushed tags
run: |
cosign verify ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }} --certificate-identity ${{ env.GH_URL }}/${{ github.repository }}/.github/workflows/ci.yml@refs/heads/main --certificate-oidc-issuer https://token.actions.githubusercontent.com
env:
COSIGN_EXPERIMENTAL: 1
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
format: 'github'
output: 'dependency-results.sbom.json'
image-ref: '.'
github-pat: ${{ secrets.GH_TOKEN }}