diff options
| -rw-r--r-- | .github/workflows/build.yml | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78323d7..6030daf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,6 +68,136 @@ jobs: path: ${{ matrix.output }} retention-days: 7 + # Build Linux packages (deb and apk) + build-packages: + name: Build Linux Packages + needs: build-binaries + runs-on: ubuntu-latest + strategy: + matrix: + arch: [amd64, arm64] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download binary artifact + uses: actions/download-artifact@v4 + with: + name: sovrabase-linux-${{ matrix.arch }} + + - name: Make binary executable + run: chmod +x sovrabase-linux-${{ matrix.arch }} + + - name: Install nfpm + run: | + echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list + sudo apt-get update + sudo apt-get install -y nfpm + + - name: Create nfpm config + run: | + cat > nfpm.yaml <<EOF + name: "sovrabase" + arch: "${{ matrix.arch }}" + platform: "linux" + version: "${GITHUB_REF##*/}-${GITHUB_SHA::7}" + section: "default" + priority: "extra" + maintainer: "Sovrabase Team <team@sovrabase.io>" + description: | + Sovrabase - A modern gRPC server + Built from commit ${GITHUB_SHA::7} + vendor: "Sovrabase" + homepage: "https://github.com/${{ github.repository }}" + license: "MIT" + + contents: + - src: ./sovrabase-linux-${{ matrix.arch }} + dst: /usr/bin/sovrabase + file_info: + mode: 0755 + - src: ./config.toml + dst: /etc/sovrabase/config.toml + type: config + file_info: + mode: 0644 + + overrides: + deb: + scripts: + postinstall: | + #!/bin/sh + echo "Sovrabase installed successfully" + echo "Configuration file: /etc/sovrabase/config.toml" + echo "Run with: sovrabase" + rpm: + scripts: + postinstall: | + #!/bin/sh + echo "Sovrabase installed successfully" + echo "Configuration file: /etc/sovrabase/config.toml" + echo "Run with: sovrabase" + apk: + scripts: + postinstall: | + #!/bin/sh + echo "Sovrabase installed successfully" + echo "Configuration file: /etc/sovrabase/config.toml" + echo "Run with: sovrabase" + archlinux: + scripts: + postinstall: | + #!/bin/sh + echo "Sovrabase installed successfully" + echo "Configuration file: /etc/sovrabase/config.toml" + echo "Run with: sovrabase" + EOF + + - name: Build deb package (Debian/Ubuntu) + run: | + nfpm package --packager deb --target sovrabase_${{ matrix.arch }}.deb + + - name: Build rpm package (Red Hat/Fedora/CentOS) + run: | + nfpm package --packager rpm --target sovrabase_${{ matrix.arch }}.rpm + + - name: Build apk package (Alpine) + run: | + nfpm package --packager apk --target sovrabase_${{ matrix.arch }}.apk + + - name: Build archlinux package (Arch Linux) + run: | + nfpm package --packager archlinux --target sovrabase_${{ matrix.arch }}.pkg.tar.zst + + - name: Upload deb package + uses: actions/upload-artifact@v4 + with: + name: sovrabase_${{ matrix.arch }}.deb + path: sovrabase_${{ matrix.arch }}.deb + retention-days: 30 + + - name: Upload rpm package + uses: actions/upload-artifact@v4 + with: + name: sovrabase_${{ matrix.arch }}.rpm + path: sovrabase_${{ matrix.arch }}.rpm + retention-days: 30 + + - name: Upload apk package + uses: actions/upload-artifact@v4 + with: + name: sovrabase_${{ matrix.arch }}.apk + path: sovrabase_${{ matrix.arch }}.apk + retention-days: 30 + + - name: Upload archlinux package + uses: actions/upload-artifact@v4 + with: + name: sovrabase_${{ matrix.arch }}.pkg.tar.zst + path: sovrabase_${{ matrix.arch }}.pkg.tar.zst + retention-days: 30 + # Build Docker images for multiple architectures build-docker: name: Build Docker Image |
