Skip to content

Lock file maintenance #193

Lock file maintenance

Lock file maintenance #193

---
env:
PACKAGE_NAME: prometheus-node-exporter
APT_DEPENDENCIES: ""
name: Build, package and publish
"on":
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build & Package
runs-on: ubuntu-24.04
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y ${APT_DEPENDENCIES}
if: ${{ env.APT_DEPENDENCIES != '' }}
- name: Set up Golang
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5
with:
go-version: 1.21
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Make deb package
run: make -j$(nproc) package
env:
BUILD_NUMBER: ${{ github.run_number }}
- name: Upload deb file
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: deb
path: "*.deb"
publish:
name: Publish
runs-on: ubuntu-24.04
if: github.event_name != 'pull_request'
needs: build
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Download deb artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: deb
- name: Upload to Apt repo
env:
APT_CREDENTIALS: ${{ secrets.APT_CREDENTIALS }}
APT_KEY_PASSPHRASE: ${{ secrets.APT_KEY_PASSPHRASE }}
run: |
echo $APT_CREDENTIALS > aptly-auth
find -type f -name "*.deb" -exec curl -f --netrc-file aptly-auth -XPOST -F file=@{} https://apttoo.growse.com/api/files/${PACKAGE_NAME} \;
export result=$(curl -f --netrc-file aptly-auth -X POST https://apttoo.growse.com/api/repos/defaultrepo/file/${PACKAGE_NAME})
echo $result
export failed=$(echo $result | jq '.FailedFiles | length')
if [[ "$failed" != "0" ]]; then exit 1; fi
curl -f --netrc-file aptly-auth -X PUT -H"Content-type: application/json" --data '{"Signing":{"Passphrase":"'"$APT_KEY_PASSPHRASE"'","Batch":true}}' https://apttoo.growse.com/api/publish/:./stablish