Skip to content

Commit

Permalink
Run neard Linux build on release (#10157)
Browse files Browse the repository at this point in the history
Small fixed to branch naming
Trigger near-workspaces updated only on Cargo.toml changes
  • Loading branch information
andrei-near authored Nov 13, 2023
1 parent ff9d8bf commit aacd9e4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/near_crates_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Near crates publish
on:
push:
branches: master
paths:
- 'Cargo.toml'
workflow_dispatch:

jobs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Nearcore release
name: Neard Linux binary release

on:
# Run when a new release or rc is created
release:
types: [released, prereleased]
push:
branches: master

Expand Down Expand Up @@ -31,27 +34,19 @@ jobs:
if: ${{ github.event_name == 'workflow_dispatch'}}
uses: actions/checkout@v4
with:
repository: near/nearcore
ref: ${{ github.event.inputs.branch }}

- name: Checkout nearcore master repository
- name: Checkout nearcore repository
if: ${{ github.event_name != 'workflow_dispatch'}}
uses: actions/checkout@v4
with:
repository: near/nearcore
ref: master

- name: Log rust and cargo versions
run: |
rustup --version
cargo --version
ref: ${{ github.ref_name }}

- name: Neard binary build and upload to S3
run: |
./scripts/binary_release.sh
run: ./scripts/binary_release.sh

- name: Update latest version metadata in S3
run: |
echo $(git rev-parse HEAD) > latest
branch=$(git rev-parse --abbrev-ref HEAD)
aws s3 cp --acl public-read latest s3://build.nearprotocol.com/nearcore/$(uname)/${branch}/latest
BRANCH=$(git branch --show-current)
aws s3 cp --acl public-read latest s3://build.nearprotocol.com/nearcore/$(uname)/${BRANCH}/latest
28 changes: 14 additions & 14 deletions scripts/binary_release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -eo pipefail
set -xeo pipefail

release="${1:-release}"

Expand All @@ -12,8 +12,8 @@ case "$release" in
;;
esac

branch=$(git rev-parse --abbrev-ref HEAD)
commit=$(git rev-parse HEAD)
BRANCH=$(git branch --show-current)
COMMIT=$(git rev-parse HEAD)

os=$(uname)
arch=$(uname -m)
Expand All @@ -32,22 +32,22 @@ function upload_binary {
then
tar_binary $1
tar_file=$1.tar.gz
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os}/${branch}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os}/${branch}/${commit}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os}/${branch}/${commit}/stable/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os}/${BRANCH}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os}/${BRANCH}/${COMMIT}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os}/${BRANCH}/${COMMIT}/stable/$1

aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os_and_arch}/${branch}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os_and_arch}/${branch}/${commit}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os_and_arch}/${branch}/${commit}/stable/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os_and_arch}/${BRANCH}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os_and_arch}/${BRANCH}/${COMMIT}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os_and_arch}/${BRANCH}/${COMMIT}/stable/$1

aws s3 cp --acl public-read ${tar_file} s3://build.nearprotocol.com/nearcore/${os_and_arch}/${branch}/${tar_file}
aws s3 cp --acl public-read ${tar_file} s3://build.nearprotocol.com/nearcore/${os_and_arch}/${branch}/${commit}/${tar_file}
aws s3 cp --acl public-read ${tar_file} s3://build.nearprotocol.com/nearcore/${os_and_arch}/${branch}/${commit}/stable/${tar_file}
aws s3 cp --acl public-read ${tar_file} s3://build.nearprotocol.com/nearcore/${os_and_arch}/${BRANCH}/${tar_file}
aws s3 cp --acl public-read ${tar_file} s3://build.nearprotocol.com/nearcore/${os_and_arch}/${BRANCH}/${COMMIT}/${tar_file}
aws s3 cp --acl public-read ${tar_file} s3://build.nearprotocol.com/nearcore/${os_and_arch}/${BRANCH}/${COMMIT}/stable/${tar_file}

else
folder="${release%-release}"
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os}/${branch}/${commit}/${folder}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os_and_arch}/${branch}/${commit}/${folder}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os}/${BRANCH}/${COMMIT}/${folder}/$1
aws s3 cp --acl public-read target/release/$1 s3://build.nearprotocol.com/nearcore/${os_and_arch}/${BRANCH}/${COMMIT}/${folder}/$1
fi
}

Expand Down

0 comments on commit aacd9e4

Please sign in to comment.