Files
topip/.gitea/workflows/build.yml
tchivert 2cefb2f480
build / build (push) Failing after 58s
add deb build
2024-12-29 12:08:45 +01:00

97 lines
3.3 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: GOOS=linux GOARCH=amd64 go build -o bin/topip-linux-amd64 ./src
- name: Linux build arm64
run: GOOS=linux GOARCH=arm64 go build -o bin/topip-linux-arm64 ./src
- name: Darwin build amd64
run: GOOS=darwin GOARCH=amd64 go build -o bin/topip-darwin-amd64 ./src
- name: Darwin build arm64
run: GOOS=darwin GOARCH=arm64 go build -o bin/topip-darwin-arm64 ./src
- name: Create deb dir tree
run: |
mkdir -p topip-amd64/usr/bin
mkdir -p topip-amd64/DEBIAN
mkdir -p topip-arm64/usr/bin
mkdir -p topip-arm64/DEBIAN
- name: Copy binaries
run: |
cp bin/topip-linux-amd64 topip-amd64/usr/bin/
cp bin/topip-linux-arm64 topip-arm64/usr/bin/
- name: Get version
run: |
TAG=${{ gitea.ref_name }}
echo "VERSION=${TAG#v}" | tee -a $GITEA_ENV
- name: Prepare amd64 control file
run: |
echo "Package: topip" > topip-amd64/DEBIAN/control
echo "Version: $VERSION" >> topip-amd64/DEBIAN/control
echo "Maintainer: tchivert <me@tchv.fr>" >> topip-amd64/DEBIAN/control
echo "Architecture: amd64" >> topip-amd64/DEBIAN/control
echo "Homepage: https://git.rznet.fr/tchivert/topip" >> topip-amd64/DEBIAN/control
echo "Description: another disk usage utility" >> topip-amd64/DEBIAN/control
- name: Prepare arm64 control file
run: |
echo "Package: topip" > topip-arm64/DEBIAN/control
echo "Version: $VERSION" >> topip-arm64/DEBIAN/control
echo "Maintainer: tchivert <me@tchv.fr>" >> topip-arm64/DEBIAN/control
echo "Architecture: arm64" >> topip-arm64/DEBIAN/control
echo "Homepage: https://git.rznet.fr/tchivert/topip" >> topip-arm64/DEBIAN/control
echo "Description: another disk usage utility" >> topip-arm64/DEBIAN/control
- name: Build deb files
run: |
dpkg -b topip-amd64 bin/topip-amd64.deb
dpkg -b topip-arm64 bin/topip-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/topip-amd64.deb topip_$VERSION-1_amd64.deb
mv bin/topip-arm64.deb topip_$VERSION-1_arm64.deb
- name: Release packages
run: |
curl -s -u "${{ secrets.PACKAGE_TOKEN }}" --upload-file topip_$VERSION-1_amd64.deb \
https://git.rznet.fr/api/packages/tchivert/debian/pool/stable/main/upload
curl -s -u "${{ secrets.PACKAGE_TOKEN }}" --upload-file topip_$VERSION-1_arm64.deb \
https://git.rznet.fr/api/packages/tchivert/debian/pool/stable/main/upload