diff --git a/.github/workflows/near_crates_publish.yml b/.github/workflows/near_crates_publish.yml index 459364bf91c..27050bc8d77 100644 --- a/.github/workflows/near_crates_publish.yml +++ b/.github/workflows/near_crates_publish.yml @@ -3,6 +3,8 @@ name: Near crates publish on: push: branches: master + paths: + - 'Cargo.toml' workflow_dispatch: jobs: diff --git a/.github/workflows/nearcore_deploy.yml b/.github/workflows/neard_linux_binary.yml similarity index 73% rename from .github/workflows/nearcore_deploy.yml rename to .github/workflows/neard_linux_binary.yml index 04928355318..da1fcea72e5 100644 --- a/.github/workflows/nearcore_deploy.yml +++ b/.github/workflows/neard_linux_binary.yml @@ -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 @@ -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 diff --git a/scripts/binary_release.sh b/scripts/binary_release.sh index 6fd6ca3e780..98ca30852f5 100755 --- a/scripts/binary_release.sh +++ b/scripts/binary_release.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -eo pipefail +set -xeo pipefail release="${1:-release}" @@ -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) @@ -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 }