-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
539804c
commit e2ee040
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |