Skip to content

Commit 1e0ab18

Browse files
author
Dylan
committed
release workflow
1 parent 04aa579 commit 1e0ab18

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
build:
10+
name: Build Package
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: 3.11
20+
21+
- name: Install dependencies
22+
run: pip install --upgrade setuptools wheel build
23+
24+
- name: Build the package
25+
run: python -m build
26+
27+
- name: Upload artifact
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: dist
31+
path: dist/
32+
33+
release:
34+
name: Release Package
35+
needs: build
36+
runs-on: ubuntu-latest
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
43+
- name: Download artifact
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: dist
47+
path: dist
48+
49+
- name: Debug artifact contents
50+
run: ls -l dist/
51+
52+
- name: Create GitHub Release
53+
run: |
54+
echo "Finding version from dist/ filename..."
55+
VERSION="v$(ls dist/netbox_qrcode-*.tar.gz | sed -E 's/.*netbox_qrcode-([0-9.]+)\.tar\.gz/\1/')"
56+
echo "Extracted version: $VERSION"
57+
58+
gh release create "$VERSION" dist/netbox_qrcode-*.tar.gz dist/netbox_qrcode-*.whl \
59+
--title "NetBox QRCode Print $VERSION" \
60+
--notes "Release $VERSION"
61+
62+
- name: Clean up
63+
run: |
64+
echo "Cleaning up..."
65+
rm -rf dist
66+
echo "Cleanup complete."

0 commit comments

Comments
 (0)