-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (77 loc) · 2.52 KB
/
build-on-push.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
name: Build and Upload test package
on:
workflow_dispatch:
push:
paths:
- 'debian/changelog'
jobs:
build:
runs-on: [ self-hosted, debian-12, pkg ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build packages
run: |
sudo apt-get update
sudo apt-get build-dep --no-install-recommends -y .
sudo apt-get install --no-install-recommends -y git-buildpackage debhelper devscripts
make deb
- name: Workaround actions
run: |
echo "artifacts_path=$(realpath ..)" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: |
${{ env.artifacts_path }}/*.deb
release:
needs: build
runs-on: [ self-hosted, ubuntu-24.04, pkg ]
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y reprepro gnupg git unzip openssh-client
- name: Checkout
uses: actions/checkout@v4
- name: Checkout repo
uses: actions/checkout@v4
with:
repository: ameridroid/apt-repo
path: repo
- uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
- name: Extract artifacts
run: |
ls *.deb
- name: Import GPG and ssh key
env:
GPG_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
SSH_KEY: ${{ secrets.APT_SSH_KEY }}
run: |
echo "$GPG_KEY" | gpg --import
gpg --list-keys
mkdir -p ~/.ssh
echo "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Upload packages to APT repository
run: |
cd ./repo/testing/
for package in ../../*.deb; do
for codename in bookworm trixie sid oracular; do
reprepro --ignore=wrongdistribution includedeb $codename $package
done
done
- name: Push updated repository to main branch
run: |
ls
cd ./repo
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add -A
git commit -m "Update ${{ github.event.repository.name}}" || echo "No changes to commit"
git remote set-url origin git@github.com:ameriDroid/apt-repo.git
git push origin main