Skip to content

Commit

Permalink
ci: add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Jan 23, 2024
1 parent 539804c commit e2ee040
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build Debian Package

on:
repository_dispatch:
types: [renterd-tagged]
workflow_dispatch:
inputs:
tag:
description: 'Tag to build'
required: true
default: 'v1.0.2'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
repository: SiaFoundation/renterd
ref: ${{ github.event.client_payload.tag }}

- name: Build .deb Package
run: |
echo "Building renterd .deb packages for tag ${{ github.event.client_payload.tag }}"
go generate ./...
for arch in amd64 arm64; do
# Make sure the right folder hierarchy exists for building the package
mkdir -p renterd${{ github.event.client_payload.tag }}_$arch/DEBIAN
mkdir -p renterd${{ github.event.client_payload.tag }}_$arch/usr/bin
# Build the renterd binary
GOOS=linux GOARCH=$arch go build -tags='netgo' -o renterd${{ github.event.client_payload.tag }}_$arch/usr/bin/renterd -a -ldflags='-s -w' ./cmd/renterd
# Create the control file
echo "Package: renterd" > renterd${{ github.event.client_payload.tag }}_$arch/DEBIAN/control
echo "Version: ${{ github.event.client_payload.tag }}" >> renterd${{ github.event.client_payload.tag }}_$arch/DEBIAN/control
echo "Architecture: $arch" >> renterd${{ github.event.client_payload.tag }}_$arch/DEBIAN/control
echo "Maintainer: The Sia Foundation <[email protected]>" >> renterd${{ github.event.client_payload.tag }}_$arch/DEBIAN/control
echo "Description: Renterd: The Next-Gen Sia Renter" >> renterd${{ github.event.client_payload.tag }}_$arch/DEBIAN/control
echo "Homepage: https://github.com/SiaFoundation/renterd" >> renterd${{ github.event.client_payload.tag }}_$arch/DEBIAN/control
# Build the .deb file
dpkg-deb --build renterd${{ github.event.client_payload.tag }}_$arch
# Remove the temporary folders
rm -rf renterd${{ github.event.client_payload.tag }}_$arch
# Move the .deb file to debian/pool/main/r/renterd
mv renterd${{ github.event.client_payload.tag }}_$arch.deb debian/pool/main/r/renterd/
# Update the Packages file
dpkg-scanpackages debian/pool/main/r/renterd/ /dev/null | gzip -9c > debian/dists/stable/main/binary-$arch/Packages.gz
done
- name: Create Pull Request
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'renterd: ${{ github.event.client_payload.tag }}'
title: 'renterd: ${{ github.event.client_payload.tag }}'
body: 'This is an automated PR to update renterd to ${{ github.event.client_payload.tag }}'
branch: renterd/update
base: master

0 comments on commit e2ee040

Please sign in to comment.