From 7af773d6f7883cdecf9601d7e5989571aa42d35c Mon Sep 17 00:00:00 2001 From: Ludovic Cartier Date: Fri, 25 Oct 2024 18:25:11 +0200 Subject: [PATCH] wrong name ? --- .gitea/workflows/build.yml | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..9cd28df --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,68 @@ +name: build & package varnish exporter + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20' + + - name: Checkout varnish exporter + run: git clone https://github.com/jonnenauha/prometheus_varnish_exporter varnish + + - name: Build varnish exporter for GNU/Linux / amd64 + run: GOOS=linux GOARCH=amd64 go build -o ../bin/prometheus-varnish-exporter-amd64 + working-directory: varnish + continue-on-error: true + + - name: Create deb dir tree + run: | + mkdir -p varnish-exporter-amd64/usr/bin + mkdir -p varnish-exporter-amd64/DEBIAN + + - name: Copy binaries + run: | + cp ../bin/prometheus-varnish-exporter-amd64 varnish-exporter-amd64/usr/bin/prometheus-varnish-exporter + + - name: Get version + run: | + TAG=${{ gitea.ref_name }} + echo "VERSION=${TAG#v}" | tee -a $GITEA_ENV + + - name: Prepare amd64 control file + run: | + echo "Package: varnish-exporter" > varnish-exporter-amd64/DEBIAN/control + echo "Version: $VERSION" >> varnish-exporter-amd64/DEBIAN/control + echo "Maintainer: Ludovic Cartier " >> varnish-exporter-amd64/DEBIAN/control + echo "Architecture: amd64" >> varnish-exporter-amd64/DEBIAN/control + echo "Homepage: https://git.brainsys.io/packages/prometheus-exporters" >> varnish-exporter-amd64/DEBIAN/control + echo "Description: Prometheus Exporters package for GNU/Linux Debian" >> varnish-exporter-amd64/DEBIAN/control + + - name: Build deb files + run: | + dpkg -b varnish-exporter-amd64 bin/prometheus-varnish-exporter-amd64.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/prometheus-varnish-exporter-amd64.deb prometheus-varnish-exporter_$VERSION-1_amd64.deb + + - name: Release packages + run: | + curl -s -u "${{ secrets.PACKAGE_TOKEN }}" --upload-file prometheus-varnish-exporter_$VERSION-1_amd64.deb \ + https://git.brainsys.io/api/packages/packages/debian/pool/stable/main/upload