Skip to content

fix(state-sync): Save sync hashes in the DB for more efficient lookup… #2

fix(state-sync): Save sync hashes in the DB for more efficient lookup…

fix(state-sync): Save sync hashes in the DB for more efficient lookup… #2

Workflow file for this run

name: Neard binary and Docker image release
on:
# Run when a new release or rc is created
release:
types: [published]
push:
branches: master
workflow_dispatch:
inputs:
branch:
default: 'master'
description: "Nearcore branch to build and publish"
type: string
required: true
jobs:
binary-release:
name: "Build and publish neard binary"
runs-on: "ubuntu-20.04-16core"
environment: deploy
permissions:
id-token: write # required to use OIDC authentication
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::590184106962:role/GitHubActionsRunner
aws-region: us-west-1
- name: Checkout ${{ github.event.inputs.branch }} branch
if: ${{ github.event_name == 'workflow_dispatch'}}
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Checkout nearcore release
# for release events we need to checkout all branches to be able to determine
# later branch name
if: ${{ github.event_name != 'workflow_dispatch' && github.event_name == 'release'}}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout repository for master branch
# In case of master branch we want to checkout with depth 1
if: ${{ github.event_name != 'workflow_dispatch' && github.event_name != 'release'}}
uses: actions/checkout@v4
- name: Neard binary build and upload to S3
run: ./scripts/binary_release.sh
- name: Update latest version metadata in S3
run: |
echo $(git rev-parse HEAD) > latest
BRANCH=$(git branch --show-current)
# in case of Release triggered run, branch is empty
if [ -z "$BRANCH" ]; then
BRANCH=$(git branch -r --contains=${{ github.ref_name }} | head -n1 | cut -c3- | cut -d / -f 2)
fi
aws s3 cp --acl public-read latest s3://build.nearprotocol.com/nearcore/$(uname)/${BRANCH}/latest
- name: Trigger packer image creation workflow
if: github.event_name != 'workflow_dispatch' && github.event_name == 'release'
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
COMMIT=$(git rev-parse HEAD)
BRANCH=$(git branch --show-current)
# in case of Release triggered run, branch is empty
if [ -z "$BRANCH" ]; then
BRANCH=$(git branch -r --contains=${{ github.ref_name }} | head -n1 | cut -c3- | cut -d / -f 2)
fi
curl -L -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PAGODAPLATFORM_GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/PagodaPlatform/pkr-node/dispatches \
-d '{"event_type":"packer-build","client_payload":{"image-name":"near-node-${BRANCH}-${SHORT_SHA}","neard-binary-s3-uri":"s3://build.nearprotocol.com/nearcore/Linux/${BRANCH}/${COMMIT}/neard"}}'
docker-release:
name: "Build and publish nearcore Docker image"
runs-on: "ubuntu-20.04-16core"
environment: deploy
steps:
- name: Checkout ${{ github.event.inputs.branch }} branch
if: ${{ github.event_name == 'workflow_dispatch'}}
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- name: Checkout nearcore release
# for release events we need to checkout all branches to be able to determine
# later branch name
if: ${{ github.event_name != 'workflow_dispatch' && github.event_name == 'release'}}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout repository for master branch
# In case of master branch we want to checkout with depth 1
if: ${{ github.event_name != 'workflow_dispatch' && github.event_name != 'release'}}
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_PAT_TOKEN }}
- name: Build and push Docker image to Dockerhub
run: |
COMMIT=$(git rev-parse HEAD)
BRANCH=$(git branch --show-current)
# in case of Release triggered run, branch is empty
if [ -z "$BRANCH" ]; then
BRANCH=$(git branch -r --contains=${{ github.ref_name }} | head -n1 | cut -c3- | cut -d / -f 2)
fi
make docker-nearcore
docker tag nearcore nearprotocol/nearcore:${BRANCH}-${COMMIT}
docker tag nearcore nearprotocol/nearcore:${BRANCH}
docker push nearprotocol/nearcore:${BRANCH}-${COMMIT}
docker push nearprotocol/nearcore:${BRANCH}
if [[ ${BRANCH} == "master" ]];
then
docker tag nearcore nearprotocol/nearcore:latest
docker push nearprotocol/nearcore:latest
fi