diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c80bd2a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,80 @@ +name: Build and Release + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-20.04 + + outputs: + arch: ${{ steps.get_arch.outputs.arch }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + + - name: Get architecture + id: get_arch + run: echo "::set-output name=arch::$(uname -m)" + + - name: Build + run: go build -o nvml_exporter + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: nvml_exporter-v0.2.0-${{ steps.get_arch.outputs.arch }} + path: nvml_exporter + + release: + runs-on: ubuntu-latest + needs: build + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: nvml_exporter-v0.2.0-${{ needs.build.outputs.arch }} + + - name: Make artifact executable + run: chmod +x nvml_exporter + + - name: Rename executable + run: mv nvml_exporter nvml_exporter-v0.2.0-${{ needs.build.outputs.arch }} + + - name: Create tar archive + run: tar -czvf nvml_exporter-v0.2.0-${{ needs.build.outputs.arch }}.tar.gz nvml_exporter-v0.2.0-${{ needs.build.outputs.arch }} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v0.2.0 + release_name: Release v0.2.0 + draft: false + prerelease: false + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./nvml_exporter-v0.2.0-${{ needs.build.outputs.arch }}.tar.gz + asset_name: nvml_exporter-v0.2.0-${{ needs.build.outputs.arch }}.tar.gz + asset_content_type: application/octet-stream diff --git a/README.md b/README.md index c7f14e7..d618a06 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +![GitHub Actions](https://img.shields.io/github/actions/workflow/status/p-doom/nvml_exporter/release.yml?branch=master&label=CI&logo=github) + + NVIDIA GPU Prometheus Exporter ------------------------------ @@ -30,5 +33,5 @@ To make sure that the exporter can access the NVML libraries, either add them to the search path for shared libraries. Or set `LD_LIBRARY_PATH` to point to their location. -By default the metrics are exposed on port `9445`. This can be updated using -the `-web.listen-address` flag. +By default the metrics are exposed on `localhost:9445/metrics`. The port can be +modified using the `-web.listen-address` flag.