Skip to content

Commit

Permalink
Merge pull request #50 from Chia-Network/update-libs-makefile
Browse files Browse the repository at this point in the history
Back to main.go, update makefile to still support .exe addition for w…
  • Loading branch information
cmmarslender authored Sep 12, 2022
2 parents eb92a2e + 4e1e215 commit cd39c32
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 7 deletions.
55 changes: 52 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
GOOS: ["linux", "darwin", "windows"]
GOARCH: ["amd64", "arm64"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Build Binary
env:
Expand All @@ -31,10 +31,46 @@ jobs:
name: chia-exporter-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
path: ${{ github.workspace }}/bin/chia-exporter*

release:
installers:
runs-on: ubuntu-latest
needs:
- build
strategy:
matrix:
GOOS: ["linux"]
GOARCH: ["amd64", "arm64"]
steps:
- name: Install fpm
run: sudo gem install fpm

- uses: actions/download-artifact@v3
with:
name: chia-exporter-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
path: artifacts

- name: Get tag name
if: startsWith(github.ref, 'refs/tags/')
id: tag-name
run: |
echo "::set-output name=TAG_NAME::$(echo ${{ github.ref }} | cut -d'/' -f 3)"
- name: Generate .deb
run: |
chmod +x artifacts/chia-exporter
fpm -s dir -t deb --prefix /usr/local/bin --chdir artifacts -n chia-exporter -a ${{ matrix.GOARCH }} -v "${{ steps.tag-name.outputs.TAG_NAME || github.sha }}" .
mkdir -p installer-out
mv *.deb installer-out/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: installer-chia-exporter-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
path: ${{ github.workspace }}/installer-out/*.deb

release:
runs-on: ubuntu-latest
needs:
- installers
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
Expand Down Expand Up @@ -66,4 +102,17 @@ jobs:
- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ steps.release-files.outputs.FILES }}
files: |
${{ steps.release-files.outputs.FILES }}
artifacts/installer-chia-exporter*/*.deb
- name: Get tag name
if: startsWith(github.ref, 'refs/tags/')
id: tag-name
run: |
echo "::set-output name=TAG_NAME::$(echo ${{ github.ref }} | cut -d'/' -f 3)"
- name: Trigger apt repo update
run: |
curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"release_version":"${{ steps.tag-name.outputs.TAG_NAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/chia-exporter/${{ github.sha }}/start
curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"release_version":"${{ steps.tag-name.outputs.TAG_NAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/chia-exporter/${{ github.sha }}/success/deploy
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ V = 0
Q = $(if $(filter 1,$V),,@)
M = $(shell printf "\033[34;1m▶\033[0m")

binext=""
ifeq ($(GOOS),windows)
binext=".exe"
endif

export GO111MODULE=on

.PHONY: all
Expand All @@ -21,7 +26,7 @@ all: fmt lint vet build
build: $(BIN) ; $(info $(M) building executable…) @ ## Build program binary
$Q CGO_ENABLED=0 $(GO) build \
-tags release \
-o $(BIN)/ $(notdir $(basename $(MODULE))).go
-o $(BIN)/$(notdir $(basename $(MODULE)))$(binext) main.go
# Tools

$(BIN):
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/chia-network/chia-exporter
go 1.17

require (
github.com/chia-network/go-chia-libs v0.0.12
github.com/chia-network/go-chia-libs v0.0.15
github.com/oschwald/maxminddb-golang v1.8.0
github.com/prometheus/client_golang v1.12.0
github.com/sirupsen/logrus v1.8.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chia-network/go-chia-libs v0.0.12 h1:S3bS9GF89r9oR4+DXKukk+dDGOPq8KRNfIIIxOp4hJ8=
github.com/chia-network/go-chia-libs v0.0.12/go.mod h1:v129EMDBvq0B7uV0Uelz4G+u0iIcYWteUV6bUcsY4u8=
github.com/chia-network/go-chia-libs v0.0.15 h1:rmCeCtU0vx2XcJTPNyoo2p5K68jGgDbx6Reh/nGFseM=
github.com/chia-network/go-chia-libs v0.0.15/go.mod h1:v129EMDBvq0B7uV0Uelz4G+u0iIcYWteUV6bUcsY4u8=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
Expand Down
File renamed without changes.
38 changes: 38 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,44 @@ Chia Exporter is an application that is intended to run alongside a chia install

**_This project is actively under development and relies on data that may not yet be available in a stable release of Chia Blockchain. Dev builds of chia may contain bugs or other issues that are not present in tagged releases. We do not recommend that you run pre-release/dev versions of Chia Blockchain on mission critical systems._**

## Installation

Download the correct executable file from the release page and run. If you are on debian/ubuntu, you can install using the apt repo, documented below.

### Apt Repo Installation

#### Set up the repository

1. Update the `apt` package index and install packages to allow apt to use a repository over HTTPS:

```shell
sudo apt-get update

sudo apt-get install ca-certificates curl gnupg
```

2. Add Chia's official GPG Key:

```shell
curl -sL https://repo.chia.net/FD39E6D3.pubkey.asc | sudo gpg --dearmor -o /usr/share/keyrings/chia.gpg
```

3. Use the following command to set up the stable repository.

```shell
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/chia.gpg] https://repo.chia.net/chia-exporter/debian/ stable main" | sudo tee /etc/apt/sources.list.d/chia-exporter.list > /dev/null
```

#### Install Chia Exporter

1. Update the apt package index and install the latest version of Chia Exporter

```shell
sudo apt-get update

sudo apt-get install chia-exporter
```

## Usage

First, install [chia-blockchain](https://github.com/Chia-Network/chia-blockchain). Chia exporter expects to be run on the same machine as the chia blockchain installation, and will use either the default chia config (`~/.chia/mainnet/`) or else the config located at `CHIA_ROOT`, if the environment variable is set.
Expand Down

0 comments on commit cd39c32

Please sign in to comment.