Skip to content

Commit edc302d

Browse files
committed
Add reprepro script
1 parent d04cdaf commit edc302d

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build & Publish Debian Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_call:
8+
inputs:
9+
architecture:
10+
required: true
11+
type: string
12+
version:
13+
required: true
14+
type: string
15+
16+
jobs:
17+
build-and-publish:
18+
permissions:
19+
pages: write
20+
contents: write
21+
environment: Main
22+
runs-on: ubuntu-latest
23+
env:
24+
DISTRIBUTION: any
25+
COMPONENT: main
26+
ARCHITECTURE: ${{ inputs.architecture }}
27+
RELEASE: 1
28+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
29+
KEY_ID: ${{ vars.KEY_ID }}
30+
VERSION: ${{ inputs.version }}
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v3
35+
36+
- name: Install dependencies
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y reprepro dpkg-dev curl jq gnupg debsigs
40+
41+
- name: Import GPG key
42+
run: |
43+
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
44+
echo "$KEY_ID:6:" | gpg --batch --import-ownertrust --pinentry-mode=loopback
45+
46+
- name: Download gitmastery .deb
47+
run: |
48+
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/git-mastery/app/releases/tags/${VERSION} | jq -r --arg suffix "${ARCHITECTURE}.deb" '.assets[] | select(.name | endswith($suffix)) | .browser_download_url')
49+
TRIMMED_VERSION=${VERSION#v}
50+
FILENAME="gitmastery_${TRIMMED_VERSION}-1_${ARCHITECTURE}.deb"
51+
curl -L "$DOWNLOAD_URL" -o $FILENAME
52+
53+
- name: Sign Debian package
54+
run: |
55+
debsigs -v --gpgopts="--batch --no-tty --pinentry-mode=loopback" --sign=origin --default-key="$KEY_ID" gitmastery*.deb
56+
57+
- name: Create APT repository with reprepro
58+
run: |
59+
TRIMMED_VERSION=${VERSION#v}
60+
61+
mkdir -p repo/conf
62+
echo "Origin: GitHub" >repo/conf/distributions
63+
echo "Label: GitHub Git-Mastery" >>repo/conf/distributions
64+
echo "Suite: stable" >>repo/conf/distributions
65+
echo "Codename: ${DISTRIBUTION}" >>repo/conf/distributions
66+
echo "Components: ${COMPONENT}" >>repo/conf/distributions
67+
echo "Architectures: ${ARCHITECTURE}" >>repo/conf/distributions
68+
echo "SignWith: $KEY_ID" >>repo/conf/distributions
69+
reprepro -Vb repo includedeb ${DISTRIBUTION} "gitmastery_${TRIMMED_VERSION}-${RELEASE}_${ARCHITECTURE}.deb"
70+
cp pubkey.gpg repo/pubkey.gpg
71+
cp index.html repo/
72+
73+
- name: Deploy APT repository to GitHub Pages
74+
uses: peaceiris/actions-gh-pages@v4
75+
with:
76+
github_token: ${{ secrets.GITHUB_TOKEN }}
77+
publish_dir: ./repo

0 commit comments

Comments
 (0)