Files
rdu/.gitea/workflows/build.yml
tchivert 97e0c7f94a
build / build (push) Successful in 52s
static link libs
2025-11-16 22:51:09 +01:00

97 lines
3.4 KiB
YAML

name: build
on:
push:
tags:
- 'v[0-9]+.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '>=1.20'
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # all history for all branches and tags
- name: Install dependencies
run: go mod download
- name: Linux build amd64
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o bin/rdu-linux-amd64 ./src
- name: Linux build arm64
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o bin/rdu-linux-arm64 ./src
- name: Darwin build amd64
run: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o bin/rdu-darwin-amd64 ./src
- name: Darwin build arm64
run: CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o bin/rdu-darwin-arm64 ./src
- name: Create deb dir tree
run: |
mkdir -p rdu-amd64/usr/bin
mkdir -p rdu-amd64/DEBIAN
mkdir -p rdu-arm64/usr/bin
mkdir -p rdu-arm64/DEBIAN
- name: Copy binaries
run: |
cp bin/rdu-linux-amd64 rdu-amd64/usr/bin/rdu
cp bin/rdu-linux-arm64 rdu-arm64/usr/bin/rdu
- name: Get version
run: |
TAG=${{ gitea.ref_name }}
echo "VERSION=${TAG#v}" | tee -a $GITEA_ENV
- name: Prepare amd64 control file
run: |
echo "Package: rdu" > rdu-amd64/DEBIAN/control
echo "Version: $VERSION" >> rdu-amd64/DEBIAN/control
echo "Maintainer: tchivert <me@tchv.fr>" >> rdu-amd64/DEBIAN/control
echo "Architecture: amd64" >> rdu-amd64/DEBIAN/control
echo "Homepage: https://git.rznet.fr/tchivert/rdu" >> rdu-amd64/DEBIAN/control
echo "Description: another disk usage utility" >> rdu-amd64/DEBIAN/control
- name: Prepare arm64 control file
run: |
echo "Package: rdu" > rdu-arm64/DEBIAN/control
echo "Version: $VERSION" >> rdu-arm64/DEBIAN/control
echo "Maintainer: tchivert <me@tchv.fr>" >> rdu-arm64/DEBIAN/control
echo "Architecture: arm64" >> rdu-arm64/DEBIAN/control
echo "Homepage: https://git.rznet.fr/tchivert/rdu" >> rdu-arm64/DEBIAN/control
echo "Description: another disk usage utility" >> rdu-arm64/DEBIAN/control
- name: Build deb files
run: |
dpkg -b rdu-amd64 bin/rdu-amd64.deb
dpkg -b rdu-arm64 bin/rdu-arm64.deb
- name: Create release
uses: https://gitea.com/actions/release-action@main
with:
draft: false
prerelease: false
files: |-
bin/**
api_key: "${{ secrets.RELEASE_TOKEN }}"
- name: Prepare apt repo upload
run: |
mv bin/rdu-amd64.deb rdu_$VERSION-1_amd64.deb
mv bin/rdu-arm64.deb rdu_$VERSION-1_arm64.deb
- name: Release packages
run: |
curl -s -u "${{ secrets.PACKAGE_TOKEN }}" --upload-file rdu_$VERSION-1_amd64.deb \
https://git.rznet.fr/api/packages/tchivert/debian/pool/stable/main/upload
curl -s -u "${{ secrets.PACKAGE_TOKEN }}" --upload-file rdu_$VERSION-1_arm64.deb \
https://git.rznet.fr/api/packages/tchivert/debian/pool/stable/main/upload