Skip to content

Commit

Permalink
add workflow
Browse files Browse the repository at this point in the history
change trigger

use main

change trigger

try

ff

again

ff

state

Update endpointconfig.example.json
  • Loading branch information
wanwiset25 committed Jul 3, 2024
1 parent f991f54 commit 0a76a8d
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 9 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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 }}
50 changes: 50 additions & 0 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
@@ -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 }}
25 changes: 16 additions & 9 deletions endpoint/endpointconfig.example.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Expand Down

0 comments on commit 0a76a8d

Please sign in to comment.