Update Managed Files #104
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
name: Build Binaries | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '**' | |
pull_request: | |
permissions: | |
id-token: write | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: golang:1 | |
strategy: | |
matrix: | |
GOOS: ["linux", "darwin", "windows"] | |
GOARCH: ["amd64", "arm64"] | |
steps: | |
- uses: Chia-Network/actions/git-mark-workspace-safe@main | |
- uses: actions/checkout@v4 | |
- name: Build Binary | |
env: | |
GOOS: ${{ matrix.GOOS }} | |
GOARCH: ${{ matrix.GOARCH }} | |
run: make build | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: chia-healthcheck-${{ matrix.GOOS }}-${{ matrix.GOARCH }} | |
path: ${{ github.workspace }}/bin/chia-healthcheck* | |
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@v4 | |
with: | |
name: chia-healthcheck-${{ matrix.GOOS }}-${{ matrix.GOARCH }} | |
path: artifacts | |
- name: Get tag name | |
if: startsWith(github.ref, 'refs/tags/') | |
id: tag-name | |
run: | | |
echo "TAG_NAME=$(echo ${{ github.ref }} | cut -d'/' -f 3)" >>$GITHUB_OUTPUT | |
- name: Generate .deb | |
run: | | |
chmod +x artifacts/chia-healthcheck | |
fpm -s dir -t deb --prefix /usr/local/bin --chdir artifacts -n chia-healthcheck -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@v4 | |
with: | |
name: installer-chia-healthcheck-${{ 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/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Show artifacts | |
run: tree artifacts | |
- name: Generate artifact zips | |
run: | | |
cd ${{ github.workspace }}/artifacts || exit 1 | |
DIRS=$(find . -type d -name 'chia-healthcheck*') | |
while IFS= read -r dir; do | |
echo "Creating zip for $dir..." | |
zip -r $dir.zip $dir | |
done <<< "$DIRS" | |
- name: Get tag name | |
if: startsWith(github.ref, 'refs/tags/') | |
id: tag-name | |
run: | | |
TAG_NAME=$(echo ${{ github.ref }} | cut -d'/' -f 3) | |
echo "TAG_NAME=$TAG_NAME" >>$GITHUB_ENV | |
echo "TAG_NAME=$TAG_NAME" >>$GITHUB_OUTPUT | |
- name: Upload Release Artifacts | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
FILES=$(find ${{ github.workspace }}/artifacts -type f -name 'chia-healthcheck*.zip') | |
while IFS= read -r file; do | |
gh release upload \ | |
$TAG_NAME \ | |
$file | |
done <<< "$FILES" | |
gh release upload \ | |
$TAG_NAME \ | |
artifacts/installer-chia-healthcheck*/*.deb | |
- name: Trigger apt repo update | |
uses: Chia-Network/actions/github/glue@main | |
with: | |
json_data: '{"release_version":"${{ steps.tag-name.outputs.TAG_NAME }}"}' | |
glue_url: ${{ secrets.GLUE_API_URL }} | |
glue_project: "chia-healthcheck" | |
glue_path: "trigger" |