summaryrefslogtreecommitdiff
path: root/.forgejo/workflows/deb.yml
blob: 7e0b2dd6ef4072b035d279db76b917539df6d77e (plain)
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
name: Build Deb Packages

on:
  push:
    branches:
      - '**'
  release:
    types: [published]

jobs:
  build-deb:
    name: Deb build for ${{ matrix.image }} ${{ matrix.arch }}
    strategy:
      matrix:
        image:
          - "debian:bookworm"
          - "debian:trixie"
          - "ubuntu:jammy"
          - "ubuntu:noble"
          - "ubuntu:plucky"
          - "ubuntu:questing"
        # Add arm64 here for ARM builds
        arch:
          - "amd64"
    runs-on: codeberg-small-lazy
    container:
      image: codeberg.org/jwijenbergh/debbuilder-${{ matrix.image }}-${{ matrix.arch }}
    steps:
      - name: Checkout Repository
        run: git clone --depth 1 -b ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }} common

      - name: Install build dependencies
        run: |
          cd common
          sudo apt-get update
          sudo apt-get build-dep -y .

      - name: Build Deb package
        run: |
          cd common
          dpkg-buildpackage -us -uc

      - name: Upload Deb
        if: github.event_name == 'release' && secrets.PACKAGE_TOKEN != ''
        run: |
          OWNER="${{ github.repository_owner }}"
          CODENAME="$(lsb_release -cs)"
          for DEB in $(find . -type f -name "*.deb"); do
            echo "uploading Deb: ${DEB}"
            curl --user "${OWNER}:${{ secrets.PACKAGE_TOKEN }}" \
              --upload-file "${DEB}" \
              "${{ github.server_url }}/api/packages/${OWNER}/debian/pool/${CODENAME}/main/upload?sign=true"
          done