Skip to content

Commit 1081ee1

Browse files
committed
modernize github actions
1 parent 1f00e01 commit 1081ee1

File tree

6 files changed

+151
-113
lines changed

6 files changed

+151
-113
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: GHCR Publishing
1+
name: Release | Build GHCR image
22
on:
33
release:
4-
types:
5-
- created
4+
types: [published]
5+
workflow_dispatch:
66

77
env:
88
REGISTRY: ghcr.io
@@ -38,7 +38,7 @@ jobs:
3838
uses: docker/build-push-action@v2
3939
with:
4040
context: .
41-
platforms: linux/amd64,linux/arm64
41+
platforms: linux/amd64
4242
push: true
4343
tags: ${{ steps.meta.outputs.tags }}
4444
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/release.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
name: releaser
1+
name: Release | Build Binary
22

33
on:
44
push:
55
tags:
66
- 'v*'
7+
workflow_dispatch:
78

89
jobs:
910
releaser:
@@ -21,6 +22,10 @@ jobs:
2122
go-version: '>=1.20'
2223
check-latest: true
2324
cache: true
25+
- name: Download syft binary
26+
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
27+
- name: Run syft
28+
run: syft version
2429
- name: Goreleaser
2530
uses: goreleaser/goreleaser-action@v4
2631
with:

.github/workflows/sbom.yml

-36
This file was deleted.

.github/workflows/sbom_dev.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Dev | Build SBOM
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'main'
7+
pull_request:
8+
branches-ignore:
9+
- 'main'
10+
workflow_dispatch:
11+
12+
env:
13+
TOOL_NAME: ${{ github.repository }}
14+
SUPPLIER_NAME: Interlynk
15+
SUPPLIER_URL: https://interlynk.io
16+
DEFAULT_TAG: v0.0.1
17+
PYLYNK_TEMP_DIR: $RUNNER_TEMP/pylynk
18+
SBOM_TEMP_DIR: $RUNNER_TEMP/sbom
19+
SBOM_ENV: development
20+
MS_SBOM_TOOL_URL: https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-linux-x64
21+
MS_SBOM_SBOM_PATH: $RUNNER_TEMP/sbom/_manifest/spdx_2.2/manifest.spdx.json
22+
SBOM_EXCLUDE_DIRS: "**/samples/**"
23+
24+
25+
jobs:
26+
build-sbom:
27+
name: Build SBOM
28+
runs-on: ubuntu-latest
29+
permissions:
30+
id-token: write
31+
contents: write
32+
steps:
33+
- name: Checkout Repository
34+
uses: actions/checkout@v3
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Get Tag
39+
id: get_tag
40+
run: echo "LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo 'v0.0.1')" >> $GITHUB_ENV
41+
42+
43+
- name: Set up Python
44+
uses: actions/setup-python@v4
45+
with:
46+
python-version: '3.x' # Specify the Python version needed
47+
48+
- name: Checkout Python SBOM tool
49+
run: |
50+
git clone https://github.com/interlynk-io/pylynk.git ${{ env.PYLYNK_TEMP_DIR }}
51+
cd ${{ env.PYLYNK_TEMP_DIR }}
52+
git fetch --tags
53+
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
54+
git checkout $latest_tag
55+
echo "Checked out pylynk at tag: $latest_tag"
56+
57+
- name: Install Python dependencies
58+
run: |
59+
cd ${{ env.PYLYNK_TEMP_DIR }}
60+
pip install -r requirements.txt
61+
62+
- name: Generate SBOM
63+
shell: bash
64+
run: |
65+
cd ${{ github.workspace }}
66+
mkdir -p ${{ env.SBOM_TEMP_DIR}}
67+
curl -Lo $RUNNER_TEMP/sbom-tool ${{ env.MS_SBOM_TOOL_URL }}
68+
chmod +x $RUNNER_TEMP/sbom-tool
69+
$RUNNER_TEMP/sbom-tool generate -b ${{ env.SBOM_TEMP_DIR }} -bc . -pn ${{ env.TOOL_NAME }} -pv ${{ env.LATEST_TAG }} -ps ${{ env.SUPPLIER_NAME}} -nsb ${{ env.SUPPLIER_URL }} -cd "--DirectoryExclusionList ${{ env.SBOM_EXCLUDE_DIRS }}"
70+
71+
- name: Upload SBOM
72+
run: |
73+
python3 ${{ env.PYLYNK_TEMP_DIR }}/pylynk.py --verbose upload --prod ${{env.TOOL_NAME}} --env ${{ env.SBOM_ENV }} --sbom ${{ env.MS_SBOM_SBOM_PATH }} --token ${{ secrets.INTERLYNK_SECURITY_TOKEN }}
74+

.github/workflows/sbom_release.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release | Build SBOM
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
env:
9+
TOOL_NAME: ${{ github.repository }}
10+
SUPPLIER_NAME: Interlynk
11+
SUPPLIER_URL: https://interlynk.io
12+
DEFAULT_TAG: v0.0.1
13+
PYLYNK_TEMP_DIR: $RUNNER_TEMP/pylynk
14+
SBOM_TEMP_DIR: $RUNNER_TEMP/sbom
15+
SBOM_ENV: default
16+
MS_SBOM_TOOL_URL: https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-linux-x64
17+
MS_SBOM_SBOM_PATH: $RUNNER_TEMP/sbom/_manifest/spdx_2.2/manifest.spdx.json
18+
SBOM_EXCLUDE_DIRS: "**/samples/**"
19+
20+
jobs:
21+
build-sbom:
22+
name: Build SBOM
23+
runs-on: ubuntu-latest
24+
permissions:
25+
id-token: write
26+
contents: write
27+
steps:
28+
- name: Checkout Repository
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Get Tag
34+
id: get_tag
35+
run: echo "LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo 'v0.0.1')" >> $GITHUB_ENV
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v4
39+
with:
40+
python-version: "3.x" # Specify the Python version needed
41+
42+
- name: Checkout Python SBOM tool
43+
run: |
44+
git clone https://github.com/interlynk-io/pylynk.git ${{ env.PYLYNK_TEMP_DIR }}
45+
cd ${{ env.PYLYNK_TEMP_DIR }}
46+
git fetch --tags
47+
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
48+
git checkout $latest_tag
49+
echo "Checked out pylynk at tag: $latest_tag"
50+
51+
- name: Install Python dependencies
52+
run: |
53+
cd ${{ env.PYLYNK_TEMP_DIR }}
54+
pip install -r requirements.txt
55+
56+
- name: Generate SBOM
57+
shell: bash
58+
run: |
59+
cd ${{ github.workspace }}
60+
mkdir -p ${{ env.SBOM_TEMP_DIR}}
61+
curl -Lo $RUNNER_TEMP/sbom-tool ${{ env.MS_SBOM_TOOL_URL }}
62+
chmod +x $RUNNER_TEMP/sbom-tool
63+
$RUNNER_TEMP/sbom-tool generate -b ${{ env.SBOM_TEMP_DIR }} -bc . -pn ${{ env.TOOL_NAME }} -pv ${{ env.LATEST_TAG }} -ps ${{ env.SUPPLIER_NAME}} -nsb ${{ env.SUPPLIER_URL }} -cd "--DirectoryExclusionList ${{ env.SBOM_EXCLUDE_DIRS }}"
64+
65+
- name: Upload SBOM
66+
run: |
67+
python3 ${{ env.PYLYNK_TEMP_DIR }}/pylynk.py --verbose upload --prod ${{env.TOOL_NAME}} --env ${{ env.SBOM_ENV }} --sbom ${{ env.MS_SBOM_SBOM_PATH }} --token ${{ secrets.INTERLYNK_SECURITY_TOKEN }}

.github/workflows/scorecard.yml

-72
This file was deleted.

0 commit comments

Comments
 (0)