-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (67 loc) · 1.99 KB
/
Copy pathgithub_package_repository.yaml
File metadata and controls
80 lines (67 loc) · 1.99 KB
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
name: Publish Docker image to GitHub Package Registry
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: {}
schedule:
- cron: '30 22 * * 3'
env:
REGISTRY: ghcr.io
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
security-events: write
steps:
- name: "actions: Checkout repository"
id: checkout
uses: actions/checkout@v2
- name: "docker: Login to Container Registry"
id: docker-login
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "docker: Extract metadata"
id: docker-meta
uses: docker/metadata-action@v3
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}
- name: "docker: Build image"
id: docker-build
uses: docker/build-push-action@v2
with:
context: .
push: false
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
- name: "anchore: Scan the Docker Image"
id: anchore-scan
uses: anchore/scan-action@v3
with:
image: ${{ steps.docker-build.outputs.digest }}
fail-build: false
acs-report-enable: true
severity-cutoff: "critical"
- name: "anchore: Upload SARIF report"
id: anchore-upload
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: results.sarif
- name: "docker: Push Docker image [main branch]"
id: docker-publish
if: github.ref_name == 'main'
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}