Skip to content

Commit a105e5e

Browse files
authored
Merge pull request #25 from konstruktoid/gha
add slsa and scorecard actions
2 parents c9a9a96 + 3bb747e commit a105e5e

File tree

4 files changed

+130
-0
lines changed

4 files changed

+130
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @konstruktoid

.github/workflows/scorecards.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Scorecards supply-chain security
2+
on:
3+
# Only the default branch is supported.
4+
branch_protection_rule:
5+
schedule:
6+
- cron: '23 9 * * 1'
7+
push:
8+
branches: [ "master" ]
9+
10+
# Declare default permissions as read only.
11+
permissions: read-all
12+
13+
jobs:
14+
analysis:
15+
name: Scorecards analysis
16+
runs-on: ubuntu-latest
17+
permissions:
18+
# Needed to upload the results to code-scanning dashboard.
19+
security-events: write
20+
# Used to receive a badge.
21+
id-token: write
22+
# Needs for private repositories.
23+
contents: read
24+
actions: read
25+
26+
steps:
27+
- name: "Checkout code"
28+
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
29+
with:
30+
persist-credentials: false
31+
32+
- name: "Run analysis"
33+
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
34+
with:
35+
results_file: results.sarif
36+
results_format: sarif
37+
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
38+
# - you want to enable the Branch-Protection check on a *public* repository, or
39+
# - you are installing Scorecards on a *private* repository
40+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
41+
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
42+
43+
# Publish the results for public repositories to enable scorecard badges. For more details, see
44+
# https://github.com/ossf/scorecard-action#publishing-results.
45+
# For private repositories, `publish_results` will automatically be set to `false`, regardless
46+
# of the value entered here.
47+
publish_results: true
48+
49+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
50+
# format to the repository Actions tab.
51+
- name: "Upload artifact"
52+
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # tag=v3.1.1
53+
with:
54+
name: SARIF file
55+
path: results.sarif
56+
retention-days: 5
57+
58+
# Upload the results to GitHub's code scanning dashboard.
59+
- name: "Upload to code-scanning"
60+
uses: github/codeql-action/upload-sarif@959cbb7472c4d4ad70cdfe6f4976053fe48ab394 # v2.1.37
61+
with:
62+
sarif_file: results.sarif

.github/workflows/slsa.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
name: slsa
3+
on:
4+
push:
5+
release:
6+
types: [published, released]
7+
8+
jobs:
9+
build:
10+
outputs:
11+
hashes: ${{ steps.hash.outputs.hashes }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
15+
shell: bash
16+
17+
- name: Checkout repository
18+
uses: actions/checkout@master
19+
20+
- name: Build artifacts
21+
run: |
22+
find tymely -type f -exec sha256sum {} \; > ${{ env.REPOSITORY_NAME }}.sha256
23+
24+
- name: Generate hashes
25+
shell: bash
26+
id: hash
27+
run: |
28+
echo "hashes=$(sha256sum ${{ env.REPOSITORY_NAME }}.sha256 | base64 -w0)" >> "$GITHUB_OUTPUT"
29+
30+
- name: Upload ${{ env.REPOSITORY_NAME }}.sha256
31+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
32+
with:
33+
name: ${{ env.REPOSITORY_NAME }}.sha256
34+
path: ${{ env.REPOSITORY_NAME }}.sha256
35+
if-no-files-found: error
36+
retention-days: 5
37+
38+
provenance:
39+
needs: [build]
40+
permissions:
41+
actions: read
42+
id-token: write
43+
contents: write
44+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.4.0
45+
with:
46+
base64-subjects: "${{ needs.build.outputs.hashes }}"
47+
upload-assets: true
48+
49+
release:
50+
needs: [build, provenance]
51+
runs-on: ubuntu-latest
52+
if: startsWith(github.ref, 'refs/tags/')
53+
steps:
54+
- run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
55+
shell: bash
56+
57+
- name: Download ${{ env.REPOSITORY_NAME }}.sha256
58+
uses: actions/download-artifact@f023be2c48cc18debc3bacd34cb396e0295e2869 # v2.1.0
59+
with:
60+
name: ${{ env.REPOSITORY_NAME }}.sha256
61+
62+
- name: Upload asset
63+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
64+
with:
65+
files: |
66+
${{ env.REPOSITORY_NAME }}.sha256

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
__pycache__
22
.sonar
33
.scannerwork
4+
.tox
45
.vagrant/

0 commit comments

Comments
 (0)