Skip to content

add direct download link to installation instructions #71

add direct download link to installation instructions

add direct download link to installation instructions #71

name: "build packages and repo"
on:
push:
tags: ['v*']
branches:
- "main"
workflow_dispatch:
pull_request:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write # write access required to attach .deb files to release
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
jobs:
build-package:
runs-on: ubuntu-${{matrix.distro}}
strategy:
fail-fast: false
matrix:
distro:
- 20.04 # focal
- 22.04 # jammy
- 24.04 # noble
env:
OS_VERSION: ${{ matrix.distro }}
steps:
- name: "Map to OS version name "
id: map_to_release
run: |
declare -A version_number_to_name=(["20.04"]="focal" ["22.04"]="jammy" ["24.04"]="noble")
version_name=${version_number_to_name[$OS_VERSION]}
echo "Building package for: $version_name"
echo "OS_NAME=${version_name}" >> $GITHUB_ENV
- name: "install dependencies"
env:
DEBIAN_FRONTEND: noninteractive
run: |
echo "Running on $OS_NAME"
sudo apt-get update
# for checkout and go
sudo apt-get install -y git curl
# needed for bootstrapping mk-build-deps
sudo apt-get install -y devscripts equivs
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
fetch-tags: true
fetch-depth: 0
show-progress: false
- name: "setup go environment"
id: go
uses: actions/setup-go@v5
with:
go-version: '1.23.0'
- name: "compile + package"
run: |
git config --global --add safe.directory "$PWD"
debian/doch.pl --project do-dcgm-exporter --distribution $OS_NAME > debian/changelog
sudo mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
sudo make build
sudo dpkg-buildpackage -b --no-sign
# don't include build-deps
rm *build-deps*.deb
sudo dpkg -I ../*.deb
sudo dpkg --contents ../*.deb
mv ../do-dcgm-exporter_*.deb .
# add focal/jammy/noble suffix to be able to distinguish when uploading to releases
for file in do-dcgm-exporter_*.deb; do
new_name="${file%%.deb*}-$OS_NAME.deb"
mv "$file" "$new_name"
done
ls -lh
- uses: actions/upload-artifact@v4
with:
name: pool-${{ env.OS_NAME }}
path: '*.deb'
build-repo:
if: ${{ github.ref_type == 'tag' }}
runs-on: ubuntu-24.04
needs: build-package
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
outputs:
page_url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: "install dependencies"
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install -y git
sudo apt-get install -y gpg dpkg-dev apt-utils
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: pool-focal
path: pool/focal
- uses: actions/download-artifact@v4
with:
name: pool-jammy
path: pool/jammy
- uses: actions/download-artifact@v4
with:
name: pool-noble
path: pool/noble
- name: "upload .debs to Github releases/tag"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ls -la pool/*
gh release list
for file in **/**/do-dcgm-exporter_*.deb; do
echo "uploading $file for release with name ${{ github.ref_name }}"
# relies on the github release having the same name as the tag!
gh release upload --clobber ${{ github.ref_name }} $file
done
- uses: ./.github/actions/deb-repo
with:
repo_root: repo_root
dist_pool: pool # filepath under which the .debs are
private_key: ${{ secrets.PRIVATE_KEY }}
private_key_email: ${{ secrets.PRIVATE_KEY_EMAIL }}
- uses: actions/configure-pages@v5
with:
enablement: true
- uses: actions/upload-pages-artifact@v3
with:
path: 'repo_root'
- uses: actions/deploy-pages@v4
id: deployment
test-repo:
runs-on: ubuntu-24.04
needs: build-repo
steps:
- name: test
run: |
echo ${{ needs.build-repo.outputs.page_url }}