Skip to content

update

update #3

Workflow file for this run

name: Release decenzed-node
# Triggered by pushing a version tag (e.g. `git tag v1.2.0 && git push origin v1.2.0`).
# Builds the node binaries for every platform, generates a checksum manifest, and
# publishes a Release in the PUBLIC distribution repo (icecube092/decenzed-node)
# using the DECENZED_NODE_GIT_TOKEN secret. Nodes auto-update from that repo's
# releases (update_manifest.txt points at its /releases/latest/download/manifest.json).
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
release:
runs-on: ubuntu-latest
env:
DIST_REPO: icecube092/decenzed-node
TAG: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: src/go.mod
cache-dependency-path: src/go.sum
- name: Build binaries (all platforms)
working-directory: src
run: |
set -euo pipefail
mkdir -p ../dist
platforms="linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64"
for p in $platforms; do
os="${p%/*}"; arch="${p#*/}"
out="decenzed-node-${os}-${arch}"
[ "$os" = "windows" ] && out="${out}.exe"
echo "==> $out ($TAG)"
GOOS="$os" GOARCH="$arch" CGO_ENABLED=0 \
go build -trimpath -ldflags "-s -w -X main.version=${TAG}" \
-o "../dist/${out}" ./cmd/decenzed-node
done
- name: Generate manifest.json
working-directory: dist
run: |
set -euo pipefail
{
echo '{'
echo " \"version\": \"${TAG#v}\","
echo ' "assets": {'
first=1
for f in decenzed-node-*; do
case "$f" in *.exe) key="${f%.exe}";; *) key="$f";; esac
key="${key#decenzed-node-}" # os-arch
key="${key/-/_}" # os_arch (manifest key = GOOS_GOARCH)
sha="$(sha256sum "$f" | cut -d' ' -f1)"
url="https://github.com/${DIST_REPO}/releases/download/${TAG}/${f}"
[ "$first" -eq 0 ] && echo ','
first=0
printf ' "%s": { "url": "%s", "sha256": "%s" }' "$key" "$url" "$sha"
done
echo
echo ' }'
echo '}'
} > manifest.json
echo "----- manifest.json -----"
cat manifest.json
- name: Publish release in ${{ env.DIST_REPO }}
env:
GH_TOKEN: ${{ secrets.DECENZED_NODE_GIT_TOKEN }}
run: |
set -euo pipefail
gh release create "$TAG" \
--repo "$DIST_REPO" \
--title "$TAG" \
--notes "Automated release of decenzed-node $TAG" \
dist/decenzed-node-* dist/manifest.json