Skip to content

Commit b7b34b1

Browse files
committed
update workflow
1 parent 8c8ffd5 commit b7b34b1

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Sign Debian Packages on Tag
1+
name: Build Debian Packages on Tag
22

33
on:
44
push:
@@ -15,16 +15,10 @@ jobs:
1515
- name: Checkout code
1616
uses: actions/checkout@v3
1717

18-
- name: Install CMake
18+
- name: Install CMake and dependencies
1919
run: |
2020
sudo apt-get update
21-
sudo apt-get install -y cmake build-essential debhelper devscripts gnupg
22-
23-
- name: Import GPG Key
24-
run: |
25-
echo "${{ secrets.GPG_SECRET_KEY }}" | base64 -d > private.key
26-
gpg --import private.key
27-
rm private.key # Clean up the key file
21+
sudo apt-get install -y cmake build-essential debhelper devscripts gnupg jq curl
2822
2923
- name: Build
3024
run: |
@@ -35,16 +29,33 @@ jobs:
3529
3630
- name: Build Debian Package
3731
run: |
38-
cd ..
39-
dpkg-buildpackage -S -sa -d
32+
dpkg-buildpackage -b
33+
34+
- name: Move DEB Files to Artifacts Directory
35+
run: |
36+
mkdir -p build/artifacts
37+
mv ../*.deb build/artifacts/
4038
41-
- name: Sign Debian Package
39+
- name: Get Release Upload URL
40+
id: get_release
41+
run: |
42+
TAG_NAME=${{ github.ref_name }}
43+
RESPONSE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
44+
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG_NAME")
45+
echo "Upload URL: $(echo $RESPONSE | jq -r .upload_url | sed 's/{.*//')"
46+
echo "upload_url=$(echo $RESPONSE | jq -r .upload_url | sed 's/{.*//')" >> $GITHUB_ENV
47+
48+
- name: Upload DEB Files to Release
49+
run: |
50+
for file in build/artifacts/*.deb; do
51+
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
52+
-H "Content-Type: application/octet-stream" \
53+
--data-binary @"$file" \
54+
"$upload_url?name=$(basename $file)"
55+
done
56+
env:
57+
upload_url: ${{ env.upload_url }}
58+
59+
- name: Cleanup
4260
run: |
43-
cd ..
44-
debsign ../*.changes
45-
46-
- name: Upload Debian Packages
47-
uses: actions/upload-artifact@v3
48-
with:
49-
name: debian-packages
50-
path: ../*.deb
61+
rm -rf build

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ obj-x86_64-linux-gnu/*
55
debian/.debhelper/*
66
debian/ndate/*
77
debian/usr/*
8-
debian/debhelper-build-stamp/*
8+
debian/debhelper-build-stamp
99
debian/files
1010
debian/ndate.substvars
1111
debian/ndate.debhelper.log

0 commit comments

Comments
 (0)