diff --git a/.github/workflows/build-binaries-and-push-to-r2.yaml b/.github/workflows/build-binaries-and-push-to-r2.yaml new file mode 100644 index 000000000..957fa4641 --- /dev/null +++ b/.github/workflows/build-binaries-and-push-to-r2.yaml @@ -0,0 +1,64 @@ +name: Upload core binary to Cloudflare R2 bucket + +on: + push: + branches: + - main + workflow_dispatch: + inputs: + branch: + description: Github branch to checkout for build + required: true + default: main + type: string + +jobs: + build-and-upload: + name: Build binary and push to R2 + runs-on: ubuntu-20.04 + permissions: + contents: write + packages: write + id-token: write + steps: + - name: Determine branch + id: get-branch-name + run: | + if [ "${{ github.event_name }}" == "push" ]; then + branch="main" + else + branch="${{ inputs.branch }}" + fi + echo "branch=$branch" >> $GITHUB_OUTPUT + + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: "0" + path: axelar-core + submodules: recursive + ref: ${{ steps.get-branch-name.outputs.branch }} + + - name: Build axelard binary with version and commit hash + id: build-binary + run: | + mkdir ./binary_file/ + cd axelar-core + make build + semver=$(git describe --tags) + echo "Semantic Version of current binary: $semver" + cd .. + sudo mv axelar-core/bin/axelard ./binary_file/axelard-linux-amd64-$semver + echo "binary-directory=./binary_file" >> $GITHUB_OUTPUT + + - name: List contents of root directory + run: ls -la + + - uses: ryand56/r2-upload-action@latest + with: + r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} + r2-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_CF }} + r2-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_CF }} + r2-bucket: ${{ secrets.R2_BUCKET }} + source-dir: ${{ steps.build-binary.outputs.binary-directory }} + destination-dir: ./pre-releases/axelard/ diff --git a/.github/workflows/build-docker-image-and-binaries.yaml b/.github/workflows/build-docker-image-and-binaries.yaml index 4773b4138..8e3d0325d 100644 --- a/.github/workflows/build-docker-image-and-binaries.yaml +++ b/.github/workflows/build-docker-image-and-binaries.yaml @@ -130,6 +130,16 @@ jobs: S3_PATH: s3://axelar-releases/axelard/${{ github.event.inputs.tag }} run: | aws s3 cp ./bin ${S3_PATH}/ --recursive + + - name: Upload binaries to Cloudflare R2 + - uses: ryand56/r2-upload-action@latest + with: + r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} + r2-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_CF }} + r2-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_CF }} + r2-bucket: ${{ secrets.R2_BUCKET }} + source-dir: ./bin + destination-dir: ./releases/axelard/ release-docker: