-
Notifications
You must be signed in to change notification settings - Fork 2
153 lines (124 loc) · 3.86 KB
/
Copy pathrelease.yml
File metadata and controls
153 lines (124 loc) · 3.86 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
id-token: write # needed for PyPI trusted publishing
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: linux-amd64
exe_suffix: ""
- os: macos-latest
target: darwin-amd64
exe_suffix: ""
- os: macos-14
target: darwin-arm64
exe_suffix: ""
- os: windows-latest
target: windows-amd64
exe_suffix: ".exe"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Stamp version and build date
run: |
TAG="${GITHUB_REF_NAME#v}"
DATE="$(date -u +%Y-%m-%d)"
sed -i.bak "s/^__version__ = .*/__version__ = \"${TAG}\"/" pipeaudit/version.py
sed -i.bak "s/^__build_date__ = .*/__build_date__ = \"${DATE}\"/" pipeaudit/version.py
cat pipeaudit/version.py
shell: bash
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install .
- name: Build binary
run: |
pyinstaller --onefile \
--name pipeaudit-${{ matrix.target }} \
--collect-all pipeaudit \
pipeaudit/__main__.py
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pipeaudit-${{ matrix.target }}
path: dist/pipeaudit-${{ matrix.target }}${{ matrix.exe_suffix }}
pypi-publish:
runs-on: ubuntu-latest
# Restrict to tagged releases only
environment:
name: pypi
url: https://pypi.org/p/pipeaudit
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Stamp version and build date
run: |
TAG="${GITHUB_REF_NAME#v}"
DATE="$(date -u +%Y-%m-%d)"
sed -i "s/^__version__ = .*/__version__ = \"${TAG}\"/" pipeaudit/version.py
sed -i "s/^__build_date__ = .*/__build_date__ = \"${DATE}\"/" pipeaudit/version.py
cat pipeaudit/version.py
- name: Build sdist and wheel
run: |
python -m pip install --upgrade pip build
python -m build
ls -lh dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release
# Collect binaries from artifact directories
for dir in artifacts/*/; do
cp "$dir"* release/
done
# Include install script
cp install.sh release/
# Generate checksums
cd release
sha256sum * > checksums-sha256.txt
echo "=== Release assets ==="
ls -lh
echo ""
cat checksums-sha256.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
body: |
## Install
**One-line install (Linux / macOS):**
```bash
curl -fsSL https://raw.githubusercontent.com/accuknox/gh-audit/main/install.sh | sh
```
**Or download a binary directly** from the assets below.
**Or install via pip:**
```bash
pip install pipeaudit
```
See [README](https://github.com/accuknox/gh-audit#readme) for setup instructions.
files: |
release/*