mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
Merge pull request #2 from DeBankDeFi/manjusaka/update-ci
Manjusaka/update ci
This commit is contained in:
commit
50eccc77ec
4 changed files with 60 additions and 129 deletions
43
.github/workflows/build.debank.yml
vendored
43
.github/workflows/build.debank.yml
vendored
|
|
@ -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}
|
||||
35
.github/workflows/build.yml
vendored
35
.github/workflows/build.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
43
.github/workflows/release.debank.yml
vendored
43
.github/workflows/release.debank.yml
vendored
|
|
@ -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}
|
||||
68
.github/workflows/release.yml
vendored
68
.github/workflows/release.yml
vendored
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -50,12 +49,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: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
- name: Upload Linux release binary
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
with:
|
||||
aws-region: ${{ env.AWS_REGION }}
|
||||
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: 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: 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 }}
|
||||
Loading…
Reference in a new issue