diff --git a/.github/buildkit-config.toml b/.github/buildkit-config.toml new file mode 100644 index 000000000..f6dc45486 --- /dev/null +++ b/.github/buildkit-config.toml @@ -0,0 +1,2 @@ +[worker.oci] + max-parallelism = 1 diff --git a/.github/workflows/build-docker-image-and-binaries.yaml b/.github/workflows/build-docker-image-and-binaries.yaml new file mode 100644 index 000000000..0ad04cf4a --- /dev/null +++ b/.github/workflows/build-docker-image-and-binaries.yaml @@ -0,0 +1,79 @@ +name: Upload Binaries and Docker Image + +on: + workflow_dispatch: + inputs: + tag: + description: Github tag to release binaries for (reusing same tag will overwrite previously released binaries) + required: true + default: latest + +jobs: + release: + strategy: + matrix: + os: + - ubuntu-18.04 + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: '0' + ref: ${{ github.event.inputs.tag }} + submodules: recursive + + - name: Set up ssh agent + uses: webfactory/ssh-agent@v0.5.2 + with: + ssh-private-key: ${{ secrets.CICD_RSA_KEY }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + with: + config: ./.github/buildkit-config.toml + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - name: Build and push docker image for all platforms + run: | + make build-push-docker-images + env: + SEMVER: ${{ steps.release.outputs.new_tag }} + + - name: Build Binaries for Linux/MacOS + env: + SEMVER: ${{ steps.release.outputs.new_tag }} + run: | + make build-binaries-in-docker + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./bin/* + tag: ${{ steps.release.outputs.new_tag }} + overwrite: true + file_glob: true + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 + + - name: Upload binaries to S3 + env: + S3_PATH: s3://axelar-releases/axelard/${{ steps.release.outputs.new_tag }} + run: | + aws s3 cp ./bin ${S3_PATH}/ --recursive diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e3793b70b..1d81d0b18 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -80,55 +80,3 @@ jobs: TAG_CONTEXT: branch RELEASE_BRANCHES: main,releases.* WITH_V: true - - - name: Set up ssh agent - uses: webfactory/ssh-agent@v0.5.2 - with: - ssh-private-key: ${{ secrets.CICD_RSA_KEY }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_TOKEN }} - - - name: Build and push docker image for all platforms - run: | - make build-push-docker-images - env: - SEMVER: ${{ steps.release.outputs.new_tag }} - - - name: Build Binaries for Linux/MacOS - env: - SEMVER: ${{ steps.release.outputs.new_tag }} - run: | - make build-binaries-in-docker - - - name: Upload binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./bin/* - tag: ${{ steps.release.outputs.new_tag }} - overwrite: true - file_glob: true - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-2 - - - name: Upload binaries to S3 - env: - S3_PATH: s3://axelar-releases/axelard/${{ steps.release.outputs.new_tag }} - run: | - aws s3 cp ./bin ${S3_PATH}/ --recursive diff --git a/Makefile b/Makefile index 7fb91fabc..381227c01 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ build-binaries: guard-SEMVER .PHONY: build-binaries-in-docker build-binaries-in-docker: guard-SEMVER - docker build \ + DOCKER_BUILDKIT=1 docker build \ --ssh default \ --build-arg SEMVER=${SEMVER} \ -t axelar/core:binaries \ @@ -61,8 +61,8 @@ docker-image: .PHONY: build-push-docker-image build-push-docker-images: guard-SEMVER - DOCKER_BUILDKIT=1 docker buildx build \ - --platform linux/amd64 \ + @DOCKER_BUILDKIT=1 docker buildx build \ + --platform linux/arm64,linux/amd64,linux/arm/v7,linux/arm/v6 \ --ssh default \ --output "type=image,push=${PUSH_DOCKER_IMAGE}" \ -t axelarnet/axelar-core:${SEMVER} . @@ -192,4 +192,4 @@ proto-update-deps: .PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps guard-%: - @ if [ -z '${${*}}' ]; then echo 'Environment variable $* not set' && exit 1; fi \ No newline at end of file + @ if [ -z '${${*}}' ]; then echo 'Environment variable $* not set' && exit 1; fi