diff --git a/.cicd/defaults.json b/.cicd/defaults.json new file mode 100644 index 0000000..258ba4e --- /dev/null +++ b/.cicd/defaults.json @@ -0,0 +1,18 @@ +{ + "leap-dev":{ + "target":"4", + "prerelease":false + }, + "leap":{ + "target":"4", + "prerelease":false + }, + "cdt":{ + "target":"3.1.0", + "prerelease":false + }, + "eos-evm-contract":{ + "target":"main", + "prerelease":false + } +} diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 327c1fb..7c85efd 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -7,6 +7,47 @@ on: - release/* pull_request: workflow_dispatch: + inputs: + override-leap-dev: + description: Override leap-dev target + type: string + override-leap-dev-prerelease: + type: choice + description: Override leap-dev prelease + options: + - default + - true + - false + override-leap: + description: Override leap target + type: string + override-leap-prerelease: + type: choice + description: Override leap prelease + options: + - default + - true + - false + override-cdt: + description: 'Override cdt target' + type: string + override-cdt-prerelease: + type: choice + description: Override cdt prelease + options: + - default + - true + - false + override-eos-evm-contract: + description: 'Override eos-evm-contract target' + type: string + override-eos-evm-contract-prerelease: + type: choice + description: Override eos-evm-contract prelease + options: + - default + - true + - false defaults: run: @@ -121,6 +162,46 @@ jobs: DCMAKE_BUILD_TYPE: 'Release' steps: + - name: Setup leap-dev & cdt versions + id: versions + env: + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + run: | + DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url)) + echo leap-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".target') >> $GITHUB_OUTPUT + echo leap-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".prerelease') >> $GITHUB_OUTPUT + echo leap-target=$(echo "$DEFAULTS_JSON" | jq -r '."leap".target') >> $GITHUB_OUTPUT + echo leap-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."leap".prerelease') >> $GITHUB_OUTPUT + echo cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.target') >> $GITHUB_OUTPUT + echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.prerelease') >> $GITHUB_OUTPUT + echo eos-evm-contract-target=$(echo "$DEFAULTS_JSON" | jq -r '.eos-evm-contract.target') >> $GITHUB_OUTPUT + echo eos-evm-contract-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '.eos-evm-contract.prerelease') >> $GITHUB_OUTPUT + + if [[ "${{inputs.override-leap-dev}}" != "" ]]; then + echo leap-dev-target=${{inputs.override-leap-dev}} >> $GITHUB_OUTPUT + fi + if [[ "${{inputs.override-leap-dev-prerelease}}" == +(true|false) ]]; then + echo leap-dev-prerelease=${{inputs.override-leap-dev-prerelease}} >> $GITHUB_OUTPUT + fi + if [[ "${{inputs.override-leap}}" != "" ]]; then + echo leap-target=${{inputs.override-leap}} >> $GITHUB_OUTPUT + fi + if [[ "${{inputs.override-leap-prerelease}}" == +(true|false) ]]; then + echo leap-prerelease=${{inputs.override-leap-prerelease}} >> $GITHUB_OUTPUT + fi + if [[ "${{inputs.override-cdt}}" != "" ]]; then + echo cdt-target=${{inputs.override-cdt}} >> $GITHUB_OUTPUT + fi + if [[ "${{inputs.override-cdt-prerelease}}" == +(true|false) ]]; then + echo cdt-prerelease=${{inputs.override-cdt-prerelease}} >> $GITHUB_OUTPUT + fi + if [[ "${{inputs.override-eos-evm-contract}}" != "" ]]; then + echo eos-evm-contract-target=${{inputs.override-eos-evm-contract}} >> $GITHUB_OUTPUT + fi + if [[ "${{inputs.override-eos-evm-contract-prerelease}}" == +(true|false) ]]; then + echo eos-evm-contract-prerelease=${{inputs.override-eos-evm-contract-prerelease}} >> $GITHUB_OUTPUT + fi + - name: Update Package Index & Upgrade Packages run: | apt-get update @@ -131,8 +212,8 @@ jobs: with: owner: AntelopeIO repo: cdt - target: 'v3.1.0' - prereleases: false + target: '${{steps.versions.outputs.cdt-target}}' + prereleases: ${{fromJSON(steps.versions.outputs.cdt-prerelease)}} file: 'cdt_.*amd64.deb' token: ${{ secrets.GITHUB_TOKEN }} @@ -144,8 +225,8 @@ jobs: with: owner: AntelopeIO repo: leap - target: 'v4' - prereleases: false + target: '${{steps.versions.outputs.leap-dev-target}}' + prereleases: ${{fromJSON(steps.versions.outputs.leap-dev-prerelease)}} file: 'leap-dev.*(x86_64|amd64).deb' container-package: experimental-binaries token: ${{ secrets.GITHUB_TOKEN }} @@ -155,7 +236,8 @@ jobs: with: owner: AntelopeIO repo: leap - target: 'v4' + target: '${{steps.versions.outputs.leap-target}}' + prereleases: ${{fromJSON(steps.versions.outputs.leap-prerelease)}} file: 'leap.*${{matrix.platform}}.*(x86_64|amd64).deb' token: ${{ secrets.GITHUB_TOKEN }} @@ -171,7 +253,8 @@ jobs: with: owner: eosnetworkfoundation repo: eos-evm - target: 'main' + target: '${{steps.versions.outputs.eos-evm-contract-target}}' + prereleases: ${{fromJSON(steps.versions.outputs.eos-evm-contract-prerelease)}} file: 'contract.tar.gz' artifact-name: contract.test-actions-off.tar.gz token: ${{ secrets.GITHUB_TOKEN }}