From 4d0e7882188daa1b3a9917c5e2fe7f64a7375ea2 Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Thu, 13 Jul 2023 15:27:24 +0800 Subject: [PATCH 1/3] update ci --- .github/workflows/build.debank.yml | 43 ---------------------------- .github/workflows/build.yml | 35 ---------------------- .github/workflows/release.debank.yml | 43 ---------------------------- .github/workflows/release.yml | 9 ------ 4 files changed, 130 deletions(-) delete mode 100644 .github/workflows/build.debank.yml delete mode 100644 .github/workflows/release.debank.yml diff --git a/.github/workflows/build.debank.yml b/.github/workflows/build.debank.yml deleted file mode 100644 index 1904902bce..0000000000 --- a/.github/workflows/build.debank.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: "Build artifacts" - -on: - pull_request: - branches: - - 'debank' - workflow_dispatch: - -env: - REGISTRY: 294354037686.dkr.ecr.ap-northeast-1.amazonaws.com - IMAGE: blockchain-geth - DOCKERFILE: Dockerfile.debank - -jobs: - build-and-package: - runs-on: [self-hosted, default-go-builder] - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - uses: tibdex/github-app-token@v1 - id: generate-token - with: - app_id: ${{ secrets.RELEASE_MANAGER_APP_ID }} - private_key: ${{ secrets.RELEASE_MANAGER_APP_SECRET }} - - - name: Set env - run: | - echo "REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - - name: Build image and push to ECR - run: | - docker build --build-arg ACCESS_TOKEN=${{ steps.generate-token.outputs.token }} -t ${REGISTRY}/${IMAGE}:${REVISION} -f ${DOCKERFILE} . - docker push ${REGISTRY}/${IMAGE}:${REVISION} - docker run --name dryrun --rm ${REGISTRY}/${IMAGE}:${REVISION} version - docker rmi ${REGISTRY}/${IMAGE}:${REVISION} - - - name: Lark Notification - continue-on-error: true - run: | - notiv3 "Blockchain go-ethereum image pushed 🎉" ${REGISTRY}/${IMAGE}:${REVISION} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d261db7d2..3989f7ba3a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,10 +10,6 @@ env: BUILT_BINARY_PATH: build/bin BUILT_BINARY_NAME: geth ARCHIVE_FILE_NAME: eth-latest-linux-amd64 - ARCHIVE_BUCKET: debank-build-artifacts - ARCHIVE_FILE_PREFIX: downloads/ethereum - AWS_REGION: ap-northeast-1 - jobs: build-artifacts: runs-on: [self-hosted, general] @@ -38,34 +34,3 @@ jobs: run: | git config --global url."https://${{ steps.generate-token.outputs.token }}:x-oauth-basic@github.com/DeBankDeFi".insteadOf "https://github.com/DeBankDeFi" make - - - name: Set env - run: | - echo "ARCHIVE_FILE_NAME=eth-$(git rev-parse --short HEAD)-linux-amd64" >> $GITHUB_ENV - - - name: Archive artifacts - run: | - mkdir $ARCHIVE_FILE_NAME - cp $BUILT_BINARY_PATH/$BUILT_BINARY_NAME $ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME - sha256sum $ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME --tag >> $ARCHIVE_FILE_NAME/sha256.checksum - chmod u+x $ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME - $ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME version - tar cvfz $ARCHIVE_FILE_NAME.tar.gz $ARCHIVE_FILE_NAME - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-region: ${{ env.AWS_REGION }} - - - name: Copy artifacts to s3 - run: | - aws s3 cp $ARCHIVE_FILE_NAME.tar.gz s3://$ARCHIVE_BUCKET/$ARCHIVE_FILE_PREFIX/$ARCHIVE_FILE_NAME.tar.gz --acl public-read - - - name: comment PR - uses: unsplash/comment-on-pr@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - msg: "Artifacts uploaded, click or copy [this link](https://${{ env.ARCHIVE_BUCKET }}.s3.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ARCHIVE_FILE_PREFIX }}/${{ env.ARCHIVE_FILE_NAME }}.tar.gz) to download. :tada:" - check_for_duplicate_msg: true - continue-on-error: true diff --git a/.github/workflows/release.debank.yml b/.github/workflows/release.debank.yml deleted file mode 100644 index 42101053c9..0000000000 --- a/.github/workflows/release.debank.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: "Release artifacts" - -on: - release: - types: - - created - workflow_dispatch: - -env: - REGISTRY: 294354037686.dkr.ecr.ap-northeast-1.amazonaws.com - IMAGE: blockchain-geth - DOCKERFILE: Dockerfile.debank - -jobs: - build-and-package: - runs-on: [self-hosted, default-go-builder] - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - uses: tibdex/github-app-token@v1 - id: generate-token - with: - app_id: ${{ secrets.RELEASE_MANAGER_APP_ID }} - private_key: ${{ secrets.RELEASE_MANAGER_APP_SECRET }} - - - name: Set env - run: | - echo "REVISION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - - name: Build image and push to ECR - run: | - docker build --build-arg ACCESS_TOKEN=${{ steps.generate-token.outputs.token }} -t ${REGISTRY}/${IMAGE}:${REVISION} -f ${DOCKERFILE} . - docker push ${REGISTRY}/${IMAGE}:${REVISION} - docker run --name dryrun --rm ${REGISTRY}/${IMAGE}:${REVISION} version - docker rmi ${REGISTRY}/${IMAGE}:${REVISION} - - - name: Lark Notification - continue-on-error: true - run: | - notiv3 "Blockchain go-ethereum image pushed 🎉" ${REGISTRY}/${IMAGE}:${REVISION} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a6ce0284f..49e5a75053 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,12 +50,3 @@ jobs: chmod u+x $ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME $ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME version tar cvfz $ARCHIVE_FILE_NAME.tar.gz $ARCHIVE_FILE_NAME - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-region: ${{ env.AWS_REGION }} - - - name: Copy artifacts to s3 - run: | - aws s3 cp $ARCHIVE_FILE_NAME.tar.gz s3://$ARCHIVE_BUCKET/$ARCHIVE_FILE_PREFIX/$ARCHIVE_FILE_NAME.tar.gz --acl public-read From f3d2a126bd65a87b688ef4c85de9e3d656703233 Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Wed, 19 Jul 2023 14:32:07 +0800 Subject: [PATCH 2/3] Update CI Signed-off-by: Manjusaka --- .github/workflows/release.yml | 64 ++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 49e5a75053..5ecdc6e7c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ env: jobs: release-artifacts: - runs-on: [self-hosted, general] + runs-on: [self-hosted] steps: - name: Install Go uses: actions/setup-go@v2 @@ -50,3 +50,65 @@ jobs: chmod u+x $ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME $ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME version tar cvfz $ARCHIVE_FILE_NAME.tar.gz $ARCHIVE_FILE_NAME + - uses: actions/upload-artifact@v3 + with: + name: derelay-artifact + path: $ARCHIVE_FILE_NAME.tar.gz + - name: Get release + id: get_release + uses: bruceadams/get-release@v1.2.3 + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + + - name: Upload Linux release binary + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + with: + upload_url: ${{ steps.get_release.outputs.upload_url }} + asset_path: ${{ env.BUILT_BINARY_PATH }}/${{ env.BUILT_BINARY_NAME }} + asset_name: derelay-linux + asset_content_type: application/octet-stream + + - name: Upload Linux release binary tarbal + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + with: + upload_url: ${{ steps.get_release.outputs.upload_url }} + asset_path: ${{ env.ARCHIVE_FILE_NAME }}.tar.gz + asset_name: ${{ env.ARCHIVE_FILE_NAME }}.tar.gz + asset_content_type: application/gzip + + make-image: + runs-on: ubuntu-latest + steps: + - name: Checkout dettack + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.IMAGE }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=raw,value=${{ github.sha }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile.debank + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From e608d6c502d2b4acc605865f3f8136f3514fd9de Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Wed, 19 Jul 2023 14:32:24 +0800 Subject: [PATCH 3/3] Update token Signed-off-by: Manjusaka --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ecdc6e7c4..0e5c67c6ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,6 @@ jobs: - name: Make binaries run: | - git config --global url."https://${{ steps.generate-token.outputs.token }}:x-oauth-basic@github.com/DeBankDeFi".insteadOf "https://github.com/DeBankDeFi" make - name: Set env