Files
rdns-go/.gitea/workflows/package.yml
tchivert bbda1f4a1e
docker / docker (push) Successful in 2m32s
package / apt (push) Successful in 1m16s
fix path
2025-07-20 11:37:21 +02:00

104 lines
3.4 KiB
YAML

name: package
on:
push:
tags:
- 'v[0-9]+.[0-9]+'
jobs:
apt:
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: GOOS=linux GOARCH=amd64 go build -o bin/rdns-linux-amd64
- name: Linux build arm64
run: GOOS=linux GOARCH=arm64 go build -o bin/rdns-linux-arm64
- name: Darwin build amd64
run: GOOS=darwin GOARCH=amd64 go build -o bin/rdns-darwin-amd64
- name: Darwin build arm64
run: GOOS=darwin GOARCH=arm64 go build -o bin/rdns-darwin-arm64
- name: Create deb dir tree
run: |
mkdir -p rdns-amd64/usr/bin
mkdir -p rdns-amd64/etc/rdns
mkdir -p rdns-amd64/DEBIAN
mkdir -p rdns-arm64/usr/bin
mkdir -p rdns-arm64/etc/rdns
mkdir -p rdns-arm64/DEBIAN
- name: Copy binaries
run: |
cp bin/rdns-linux-amd64 rdns-amd64/usr/bin/rdns
cp bin/rdns-linux-arm64 rdns-arm64/usr/bin/rdns
- name: Copy configuration example
run: |
cp -r conf/* rdns-amd64/etc/rdns/
cp -r conf/* rdns-arm64/etc/rdns/
- name: Get version
run: |
TAG=${{ gitea.ref_name }}
echo "VERSION=${TAG#v}" | tee -a $GITEA_ENV
- name: Prepare amd64 control file
run: |
echo "Package: rdns" > rdns-amd64/DEBIAN/control
echo "Version: $VERSION" >> rdns-amd64/DEBIAN/control
echo "Maintainer: tchivert <me@tchv.fr>" >> rdns-amd64/DEBIAN/control
echo "Architecture: amd64" >> rdns-amd64/DEBIAN/control
echo "Homepage: https://git.rznet.fr/tchivert/rdns" >> rdns-amd64/DEBIAN/control
echo "Description: another disk usage utility" >> rdns-amd64/DEBIAN/control
- name: Prepare arm64 control file
run: |
echo "Package: rdns" > rdns-arm64/DEBIAN/control
echo "Version: $VERSION" >> rdns-arm64/DEBIAN/control
echo "Maintainer: tchivert <me@tchv.fr>" >> rdns-arm64/DEBIAN/control
echo "Architecture: arm64" >> rdns-arm64/DEBIAN/control
echo "Homepage: https://git.rznet.fr/tchivert/rdns" >> rdns-arm64/DEBIAN/control
echo "Description: another disk usage utility" >> rdns-arm64/DEBIAN/control
- name: Build deb files
run: |
dpkg -b rdns-amd64 bin/rdns-amd64.deb
dpkg -b rdns-arm64 bin/rdns-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/rdns-amd64.deb rdns_$VERSION-1_amd64.deb
mv bin/rdns-arm64.deb rdns_$VERSION-1_arm64.deb
- name: Release packages
run: |
curl -s -u "${{ secrets.PACKAGE_TOKEN }}" --upload-file rdns_$VERSION-1_amd64.deb \
https://git.rznet.fr/api/packages/tchivert/debian/pool/stable/main/upload
curl -s -u "${{ secrets.PACKAGE_TOKEN }}" --upload-file rdns_$VERSION-1_arm64.deb \
https://git.rznet.fr/api/packages/tchivert/debian/pool/stable/main/upload