Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
pull_request:
branches: ["master", "develop", "release/**"]
branches: ["master", "release/**"]

concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
Expand Down
149 changes: 149 additions & 0 deletions .github/workflows/nodectl-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: Publish nodectl

on:
push:
tags:
- "nodectl/v*"

concurrency:
group: ${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: true

env:
WORKING_DIR: src

jobs:
build-binaries:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: nodectl-linux-amd64
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
name: nodectl-linux-arm64
- target: aarch64-apple-darwin
os: macos-latest
name: nodectl-darwin-arm64
- target: x86_64-pc-windows-msvc
os: windows-latest
name: nodectl-windows-amd64.exe
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- uses: actions/checkout@v5

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}

- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev

- name: Build
working-directory: ${{ env.WORKING_DIR }}
run: cargo build --release --package nodectl --target ${{ matrix.target }}
shell: bash

- name: Rename binary
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
cp src/target/${{ matrix.target }}/release/nodectl.exe ${{ matrix.name }}
else
cp src/target/${{ matrix.target }}/release/nodectl ${{ matrix.name }}
fi
shell: bash

- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}

container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v5

- uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/rsquad/ton-rust-node/nodectl
tags: |
type=match,pattern=nodectl/(v.*),group=1
type=raw,value=latest
type=sha

- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./src
file: ./src/Dockerfile.nodectl
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

release:
needs: [build-binaries, container]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5

- uses: actions/download-artifact@v4
with:
pattern: nodectl-*
path: artifacts
merge-multiple: true

- name: Extract version from tag
id: version
run: |
VERSION="${GITHUB_REF_NAME#nodectl/}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"

if echo "$VERSION" | grep -qE '(rc|alpha|beta)'; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: "nodectl/${{ steps.version.outputs.version }}"
body: |
nodectl ${{ steps.version.outputs.version }}

Image: `ghcr.io/rsquad/ton-rust-node/nodectl:${{ steps.version.outputs.version }}`
files: artifacts/*
prerelease: ${{ steps.version.outputs.prerelease }}
make_latest: false
draft: ${{ steps.version.outputs.prerelease }}

- name: Publish pre-release
if: steps.version.outputs.prerelease == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release edit "$GITHUB_REF_NAME" --draft=false
Loading
Loading