Skip to content

Commit

Permalink
use SDK release from sprint-1.11 (#1336)
Browse files Browse the repository at this point in the history
  • Loading branch information
boddumanohar authored and Hitenjain14 committed Dec 22, 2023
1 parent 920fce2 commit 10e1294
Showing 1 changed file with 21 additions and 84 deletions.
105 changes: 21 additions & 84 deletions .github/workflows/sdk-release.yml
Original file line number Diff line number Diff line change
@@ -1,127 +1,64 @@
name: GoSDK & WasmSDK
name: GoSDK Release

concurrency:
group: "sdk-${{ github.ref }}"
cancel-in-progress: true

on:
push:
branches: [ master, staging, qa ]
tags:
- 'v*.*.*'
pull_request:
branches: [ master, staging, qa, sprint-*]
workflow_dispatch:
inputs:
version:
description: '0Chain SDK version'
required: true
base:
description: the target branch to which PRs should be raised
default: sprint-1.11
required: true

env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

jobs:
build:
name: sdk-build
runs-on: [self-hosted, arc-runner]
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v2
with:
go-version: ^1.20

- name: Checkout
uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget
- name: Setup Build
id: setup_build
run: |
tag=$(echo ${GITHUB_REF#refs/tags/})
echo ${tag}
if [[ -n "${{github.event.inputs.version}}" ]]; then
echo "> 0Chain: trigger from workflow_dispatch"
echo "::set-output name=PR::true"
gosdk="{\"gosdk\":\"${{github.event.inputs.version}}\"}"
echo "::set-output name=SDK::${gosdk}"
elif [[ ${tag} = v*\.*\.* ]] ; then
echo "> 0Chain: trigger from git event"
echo "::set-output name=PR::true"
gosdk="{\"gosdk\":\"${tag}\"}"
echo "::set-output name=SDK::${gosdk}"
# upload zcn.wasm on release
echo "::set-output name=RELEASE::true"
echo "::set-output name=TAG::${tag}"
elif [[ ${tag} = "refs/heads/staging" ]] ; then
echo "> 0Chain: trigger from git event"
echo "::set-output name=PR::true"
gosdk="{\"gosdk\":\"staging\"}"
echo "::set-output name=SDK::${gosdk}"
# upload zcn.wasm on release
echo "::set-output name=RELEASE::true"
echo "::set-output name=TAG::${tag}"
fi
- name: Build
run: docker run --rm -v $PWD:/gosdk -w /gosdk golang:1.20 make wasm-build

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
if: steps.setup_build.outputs.RELEASE == 'true'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: zcn.wasm
tag: ${{ steps.setup_build.outputs.TAG }}
overwrite: true
file_glob: true

- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: zcn.wasm
path: zcn.wasm
outputs:
PR: ${{ steps.setup_build.outputs.PR }}
SDK: ${{ steps.setup_build.outputs.SDK }}
TAG: ${{ steps.setup_build.outputs.TAG }}

release:
name: sdk-release
needs: build
if: needs.build.outputs.PR == 'true'
runs-on: [self-hosted, build]
steps:
- name: start to create pr
run: |
echo "GoSDK & WebAssembly SDK should be upgraded"
create-pr:
name: create-pr
strategy:
fail-fast: false
max-parallel: 1
matrix:
repo: [0nft, 0box, 0dns, zwalletcli, zboxcli, blobber, zs3server, s3-migration, token_bridge_authserver ]
needs: [ build, release ]
repo: [0box, 0dns, zwalletcli, zboxcli, blobber, zs3server, s3-migration, token_bridge_authserver ]
needs: [ release ]
runs-on: [self-hosted, build]
steps:
- name: Extract branch or version name
shell: bash
run: |
GITHUB_REF=$(echo $GITHUB_REF | sed -e "s#refs/heads/##g")
echo $GITHUB_REF
echo ${{ github.event_name }}
echo "branch=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || '$GITHUB_REF' }}" >> $GITHUB_ENV
echo "base=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.base || '$GITHUB_REF' }}" >> $GITHUB_ENV
id: extract_branch

- name: Create PR on ${{ matrix.repo }}
uses: convictional/trigger-workflow-and-wait@v1.3.0
if: needs.build.outputs.PR == 'true'
uses: convictional/trigger-workflow-and-wait@v1.6.1
with:
owner: 0chain
repo: ${{ matrix.repo }}
ref: staging
github_token: ${{ secrets.GOSDK }}
workflow_file_name: gosdk.yml
inputs: ${{ needs.build.outputs.SDK }}
client_payload: '{"gosdk": "${{ env.branch }}", "base": "${{ env.base }}"}'
propagate_failure: true
trigger_workflow: true
wait_workflow: true

0 comments on commit 10e1294

Please sign in to comment.