This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (98 loc) · 4.08 KB
/
win.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
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
name: Build Windows Binaries
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
jobs:
cpggen-Windows-Build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Checkout cpggen
uses: actions/checkout@v3
with:
repository: AppThreat/cpggen
path: cpggen
- name: Checkout cdxgen
uses: actions/checkout@v3
with:
repository: CycloneDX/cdxgen
path: cdxgen
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
- uses: actions/setup-go@v4
with:
go-version: '^1.19.7'
- name: Install pyinstaller
run: |
python -m pip install --upgrade pip
python -m pip install setuptools pyinstaller tzdata poetry
cd cpggen
poetry config virtualenvs.create false
poetry install --no-cache --without dev
- name: Produce cdxgen pkg
run: |
npm install -g pkg
cd cdxgen
npm install
npx caxa --input . --output "cdxgen.exe" -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/bin/cdxgen.js"
.\cdxgen.exe --verion
(Get-FileHash .\cdxgen.exe).hash | Out-File -FilePath .\cdxgen.exe.sha256
- name: Binary windows build
run: |
cd cpggen
Invoke-WebRequest -Uri 'https://github.com/appthreat/atom/releases/latest/download/atom.zip' -OutFile atom.zip
pyinstaller cpggen/cli.py --noconfirm --log-level=WARN --nowindow --onefile --name atomgen --add-binary="atom.zip;local_bin" --add-binary="../cdxgen/cdxgen.exe;local_bin" --collect-submodules cpggen --disable-windowed-traceback -i ../bin-build/cpggen.ico --version-file=../bin-build/file_version_info.txt --noupx
(Get-FileHash .\dist\atomgen.exe).hash | Out-File -FilePath .\dist\atomgen.exe.sha256
.\dist\atomgen.exe --help
env:
PYTHONIOENCODING: utf-8
LANG: en_US.utf-8
PYTHONUTF8: 1
- name: Upload cpggen
run: |
cd cpggen\dist
Invoke-WebRequest -Uri https://github.com/oras-project/oras/releases/download/v1.0.0/oras_1.0.0_windows_amd64.zip -UseBasicParsing -OutFile oras_1.0.0_windows_amd64.zip
Expand-Archive -Path oras_1.0.0_windows_amd64.zip -DestinationPath .
.\oras.exe login ghcr.io -u $Env:GITHUB_USERNAME -p $Env:GITHUB_TOKEN
.\oras.exe push ghcr.io/appthreat/atomgen-windows-bin:v1 --config ../bin-build/config.json:application/vnd.oras.config.v1+json --annotation-file ../bin-build/annotations.json ./atomgen.exe:application/vnd.appthreat.atomgen.layer.v1+tar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
- name: Binary windows build
run: |
cd cpggen
pyinstaller cpggen/cli.py --noconfirm --log-level=WARN --nowindow --onefile --name cpggen --add-binary="atom.zip;local_bin" --add-binary="../cdxgen/cdxgen.exe;local_bin" --collect-submodules cpggen --disable-windowed-traceback -i ../bin-build/cpggen.ico --version-file=../bin-build/file_version_info.txt --noupx
(Get-FileHash .\dist\cpggen.exe).hash | Out-File -FilePath .\dist\cpggen.exe.sha256
.\dist\cpggen.exe --help
env:
PYTHONIOENCODING: utf-8
LANG: en_US.utf-8
PYTHONUTF8: 1
- name: Upload cpggen
run: |
cd cpggen\dist
.\oras.exe push ghcr.io/appthreat/cpggen-windows-bin:v1 --config ../bin-build/config.json:application/vnd.oras.config.v1+json --annotation-file ../bin-build/annotations.json ./cpggen.exe:application/vnd.appthreat.cpggen.layer.v1+tar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
- uses: actions/upload-artifact@v1
if: startsWith(github.ref, 'refs/tags/') != true
with:
path: cpggen/dist
name: cpggen-windows
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
cpggen/dist/cpggen.exe
cpggen/dist/cpggen.exe.sha256