From 02a318cd2ed8fb54f9c09e6016abcb2365f809ca Mon Sep 17 00:00:00 2001 From: Anton Ovchinnikov Date: Mon, 13 Apr 2026 20:34:12 +0300 Subject: [PATCH] ci: Build and publish latest (nightly) binaries (#308) * ci: Build and publish latest binaries * Use goreleaser, rename to nightly * Use exact target --- .github/workflows/nightly-build.yml | 86 +++++++++++++++++++++++++++++ mise.lock | 16 ++++++ mise.toml | 1 + scripts/install.sh | 3 + 4 files changed, 106 insertions(+) create mode 100644 .github/workflows/nightly-build.yml diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml new file mode 100644 index 00000000..cd2666e7 --- /dev/null +++ b/.github/workflows/nightly-build.yml @@ -0,0 +1,86 @@ +name: Nightly Build +on: + push: + branches: + - main + +permissions: + contents: write + +env: + MISE_VERSION: "2026.3.7" + +jobs: + nightly: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: Install Mise + uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1 + with: + version: ${{ env.MISE_VERSION }} + - name: Reset changes in mise.lock after fresh mise install + run: git checkout mise.lock + + - name: Run GoReleaser snapshot + run: goreleaser release --snapshot --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Delete existing nightly release + run: gh release delete nightly --yes --cleanup-tag || true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create nightly release + run: | + COMMIT=$(git rev-parse --short HEAD) + DATE=$(date -u '+%Y-%m-%d %H:%M UTC') + RELEASE_NOTES=$(cat < **Warning**: These are nightly development builds and may be unstable. + + **Install uncloud CLI:** + + \`\`\` + curl -fsS https://get.uncloud.run/install.sh | VERSION=nightly sh + \`\`\` + + **Initialize a cluster or add a machine:** + + \`\`\` + uc machine init --version nightly user@host + uc machine add --version nightly user@host + \`\`\` + + **Upgrade machine daemon:** + + \`\`\` + ARCH=\$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') + curl -fsSL -o uncloudd.tar.gz https://github.com/psviderski/uncloud/releases/download/nightly/uncloudd_linux_\${ARCH}.tar.gz + tar -xf uncloudd.tar.gz + sudo install uncloudd /usr/local/bin/uncloudd + rm uncloudd uncloudd.tar.gz + sudo systemctl restart uncloud + \`\`\` + + EOF + ) + + gh release create nightly \ + --title "Nightly Build" \ + --notes "${RELEASE_NOTES}" \ + --prerelease \ + --target ${{ github.sha }} \ + dist/*.tar.gz dist/checksums.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + timeout-minutes: 30 diff --git a/mise.lock b/mise.lock index ec48f6b4..b262818c 100644 --- a/mise.lock +++ b/mise.lock @@ -31,10 +31,26 @@ backend = "aqua:golangci/golangci-lint" [tools.golangci-lint."platforms.linux-x64"] checksum = "sha256:852741ea769f4543ab4b6cf86b313cb7173f2e8d2d39f00eb0cd5ef5d4d5eda9" url = "https://github.com/golangci/golangci-lint/releases/download/v2.11.2/golangci-lint-2.11.2-linux-amd64.tar.gz" +provenance = "github-attestations" [tools.golangci-lint."platforms.macos-arm64"] checksum = "sha256:11e9549b955bae4bfb71aa3b5c2762e446e2d3f975fe963d6d767b8f745d9344" url = "https://github.com/golangci/golangci-lint/releases/download/v2.11.2/golangci-lint-2.11.2-darwin-arm64.tar.gz" +provenance = "github-attestations" + +[[tools.goreleaser]] +version = "2.15.2" +backend = "aqua:goreleaser/goreleaser" + +[tools.goreleaser."platforms.linux-x64"] +checksum = "sha256:0ebdbf0353aba566b969dde746cc4e4806f96c27aa2f3971b229a9df7611fedc" +url = "https://github.com/goreleaser/goreleaser/releases/download/v2.15.2/goreleaser_Linux_x86_64.tar.gz" +provenance = "github-attestations" + +[tools.goreleaser."platforms.macos-arm64"] +checksum = "sha256:0e6bd67688ac949780bf1166813a91f89856898ef4c40d7d46c2c74ebaa4b9ee" +url = "https://github.com/goreleaser/goreleaser/releases/download/v2.15.2/goreleaser_Darwin_all.tar.gz" +provenance = "github-attestations" [[tools.node]] version = "22.20.0" diff --git a/mise.toml b/mise.toml index a38f20b3..ca11aeb0 100644 --- a/mise.toml +++ b/mise.toml @@ -5,6 +5,7 @@ experimental = true "aqua:vektra/mockery" = "3.5.3" go = "1.26.1" golangci-lint = "2.11.2" +goreleaser = "2.15.2" node = "22.20.0" protoc = "27.3" protoc-gen-go = "1.34.2" diff --git a/scripts/install.sh b/scripts/install.sh index a84121b3..3659234a 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -166,6 +166,9 @@ install_uncloud_binaries() { if [ "${UNCLOUD_VERSION}" == "latest" ]; then uncloudd_url="${UNCLOUD_GITHUB_URL}/releases/latest/download/uncloudd_linux_${file_arch}.tar.gz" uninstall_url="https://raw.githubusercontent.com/psviderski/uncloud/refs/heads/main/scripts/uninstall.sh" + elif [ "${UNCLOUD_VERSION}" == "nightly" ]; then + uncloudd_url="${UNCLOUD_GITHUB_URL}/releases/download/nightly/uncloudd_linux_${file_arch}.tar.gz" + uninstall_url="https://raw.githubusercontent.com/psviderski/uncloud/refs/heads/main/scripts/uninstall.sh" else uncloudd_url="${UNCLOUD_GITHUB_URL}/releases/download/v${UNCLOUD_VERSION}/uncloudd_linux_${file_arch}.tar.gz" uninstall_url="https://raw.githubusercontent.com/psviderski/uncloud/refs/tags/v${UNCLOUD_VERSION}/scripts/uninstall.sh"