Lock file maintenance #207
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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@3041bf56c941b39c61721a86cd11f3bb1338122a # 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@6f51ac03b9356f520e9adb1b1b7802705f340c2b # 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 |