From 0a76a8d8e8d75b54aa23553e7e0c441d32ec67ce Mon Sep 17 00:00:00 2001 From: wanwiset25 Date: Wed, 3 Jul 2024 17:25:03 +0400 Subject: [PATCH] add workflow change trigger use main change trigger try ff again ff state Update endpointconfig.example.json --- .github/workflows/ci.yml | 41 +++++++++++++++++++++++ .github/workflows/pr_build.yml | 50 ++++++++++++++++++++++++++++ endpoint/endpointconfig.example.json | 25 +++++++++----- 3 files changed, 107 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pr_build.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b88e541 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: Build and publish image +on: + push: + branches: + - main + tags: + - '*' + +jobs: + test_build_and_push_to_docker_registry: + name: Test, build and publish image to docker hub + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + # - uses: actions/setup-node@v3 + # with: + # node-version: '20.x' + # - name: Install dependencies + # run: npm install && npm run postinstall + # - name: Unit tests + # run: npm run test + - name: Docker login + env: + DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} + DOCKER_PASSWORD: ${{secrets.DOCKER_ACCESS_TOKEN}} + run: | + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + + - name: Determine Docker Image Name + id: image + run: | + if [[ "${{github.ref_name}}" == "master" ]]; then + echo "name=xinfinorg/xdc-zero:latest" >> $GITHUB_OUTPUT + else + echo "name=xinfinorg/xdc-zero:${{github.ref_name}}" >> $GITHUB_OUTPUT + fi + + - name: Docker build and tag image + run: docker build . --file Dockerfile --tag ${{ steps.image.outputs.name }} + - name: Docker push + run: docker push ${{ steps.image.outputs.name }} \ No newline at end of file diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml new file mode 100644 index 0000000..44ab4a4 --- /dev/null +++ b/.github/workflows/pr_build.yml @@ -0,0 +1,50 @@ +name: Build custom branch +on: + pull_request: + branches: + - main + +jobs: + build: + if: | + ( startsWith(github.head_ref, 'feature') || + startsWith(github.head_ref, 'fix') ) + name: Deploy on PR + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: check out trigger branch + run: | + git fetch origin $BRANCH + git checkout $BRANCH + env: + BRANCH: ${{ github.head_ref }} + + - name: Record branch env + id: branch + run: | + echo "repo=${{ github.repository }}" >> $GITHUB_OUTPUT + echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT + echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + # echo $repo + # echo $branch + # echo $commit + + - name: Docker login + env: + DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} + DOCKER_PASSWORD: ${{secrets.DOCKER_ACCESS_TOKEN}} + run: | + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + + - name: Determine Docker Image Name + id: image + run: | + echo "name=xinfinorg/xdc-zero:${{ steps.branch.outputs.branch }}" >> $GITHUB_OUTPUT + + - name: Build and push image + run: | + docker build . --file docker/Dockerfile --tag ${{ steps.image.outputs.name }} + docker push ${{ steps.image.outputs.name }} diff --git a/endpoint/endpointconfig.example.json b/endpoint/endpointconfig.example.json index b6f9547..ea6f507 100644 --- a/endpoint/endpointconfig.example.json +++ b/endpoint/endpointconfig.example.json @@ -1,28 +1,35 @@ { "xdcparentnet": { - "endpoint": "0xf218D129CD4a8bB153c9593bc5dFc12FAdfc44f4", + "endpoint": "0xB575c682301e20935B8C5846313a01E6f0Bd9f4B", "registers": [ { - "csc": "0x8EC22d14cD38FAB7C5AeF1d97105A6ec3FefEe5f", - "endpoint": "0xD4449Bf3f8E6a1b3fb5224F4e1Ec4288BD765547", - "chainId": "8851" + "csc": "0x3C714ffDB5A13d8d7EF0bE5f41F12bd840DA9ef1", + "endpoint": "0x0bb5a292b13C7983BFDCd62538e0e81603793342", + "chainId": "953" + } + ], + "applications": [ + { + "rid": "953", + "rua": "0xdfc2cD2b6AA7fD236e3A4Efa255A9b81c94B3fF4", + "sua": "0x40DC79697399686cd4003Ab9B7B87115bA945397" } ] }, "xdcsubnet": { - "endpoint": "0x550491BD078F7c5f78F16395b296E80F82f58700", + "endpoint": "0x0bb5a292b13C7983BFDCd62538e0e81603793342", "registers": [ { - "csc": "0x2475Dcd4Fe333bE814Ef7C8f8CE8A1E9B5FcDEA0", - "endpoint": "0x2475Dcd4Fe333bE814Ef7C8f8CE8A1E9B5FcDEA0", + "csc": "0x720A33E9c54dDf240D42f822E8b20D9C70226AAC", + "endpoint": "0xB575c682301e20935B8C5846313a01E6f0Bd9f4B", "chainId": "551" } ], "applications": [ { "rid": "551", - "rua": "0x5dff28627b2E4fd9516d18db6713c90d80d50f98", - "sua": "0x5dff28627b2E4fd9516d18db6713c90d80d50f98" + "rua": "0x40DC79697399686cd4003Ab9B7B87115bA945397", + "sua": "0xdfc2cD2b6AA7fD236e3A4Efa255A9b81c94B3fF4" } ] }