Skip to content

Commit

Permalink
Merge pull request #3 from ambrosus/update-deploy-script
Browse files Browse the repository at this point in the history
Update deploy script
  • Loading branch information
Eshanchik authored Oct 24, 2024
2 parents 6d1ba2b + 01d5a72 commit 0cdbcae
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 4 deletions.
58 changes: 55 additions & 3 deletions .github/workflows/build_binary_nop_x86_64.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Upload Rust Binary
name: Build and Upload AirDao Nop Binary

on:
release:
Expand All @@ -8,7 +8,7 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:
build-latest:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -56,6 +56,58 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./airdao-nop-rs-ubuntu.zip
asset_path: ./airdao-nop-rs-x86-64.zip
asset_name: airdao-nop-release-${{ env.RELEASE_VERSION }}.zip
asset_content_type: application/zip

build_20_04:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.81
override: true
components: rustfmt, clippy
target: x86_64-unknown-linux-gnu

- name: Cache cargo registry and git dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build binary
run: |
git submodule update --init --recursive
RUSTFLAGS='-C link-arg=-s' cargo build --release --target x86_64-unknown-linux-gnu
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Set Release Version
id: set_version
run: echo "RELEASE_VERSION=${{ github.event.release.tag_name }}-x86_64-ubuntu-20.04" >> $GITHUB_ENV

- name: Archive
run: zip -j airdao-nop-rs-ubuntu-20.04.zip target/x86_64-unknown-linux-gnu/release/airdao-nop-rs

- name: Upload to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./airdao-nop-rs-x86-64-old.zip
asset_name: airdao-nop-release-${{ env.RELEASE_VERSION }}.zip
asset_content_type: application/zip
19 changes: 18 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ if [ -f /etc/debian_version ]; then
DISTRO=$(lsb_release -is)
if [[ "$DISTRO" == "Debian" ]]; then

if [ ! -d "/etc/apt/keyrings" ]; then
sudo mkdir -p /etc/apt/keyrings
fi

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
Expand All @@ -31,6 +35,10 @@ if [ -f /etc/debian_version ]; then

elif [[ "$DISTRO" == "Ubuntu" ]]; then

if [ ! -d "/etc/apt/keyrings" ]; then
sudo mkdir -p /etc/apt/keyrings
fi

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
Expand Down Expand Up @@ -59,8 +67,17 @@ chmod +x update.sh
./update.sh

LATEST_TAG=$(curl -s https://api.github.com/repos/ambrosus/airdao-nop-rs/releases/latest | jq -r .tag_name)
DEBIAN_VERSION=$(lsb_release -sr)
UBUNTU_VERSION=$(lsb_release -sr)

if (( $(echo "$DEBIAN_VERSION > 11" | bc -l) )) || (( $(echo "$UBUNTU_VERSION >= 22" | bc -l) )); then
FILE_URL="https://github.com/ambrosus/airdao-nop-rs/releases/download/$LATEST_TAG/airdao-nop-rs-x86-64.zip"
else
FILE_URL="https://github.com/ambrosus/airdao-nop-rs/releases/download/$LATEST_TAG/airdao-nop-rs-x86-64-old.zip"
fi

curl -L -o airdao-nop-release.zip "$FILE_URL"

curl -L -o airdao-nop-release.zip https://github.com/ambrosus/airdao-nop-rs/releases/download/$LATEST_TAG/airdao-nop-rs-ubuntu.zip
unzip airdao-nop-release.zip
rm airdao-nop-release.zip
chmod +x ./airdao-nop-rs
Expand Down

0 comments on commit 0cdbcae

Please sign in to comment.