Skip to content

Commit

Permalink
Add configurability to workflow for leap, leap-dev, cdt, and eos-evm-…
Browse files Browse the repository at this point in the history
…contract artifact acquisition.
  • Loading branch information
oschwaldp-oci committed Aug 2, 2023
1 parent cdbb6e6 commit ef8d9cc
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 6 deletions.
18 changes: 18 additions & 0 deletions .cicd/defaults.json
Original file line number Diff line number Diff line change
@@ -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
}
}
95 changes: 89 additions & 6 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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 }}

Expand All @@ -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 }}
Expand All @@ -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 }}

Expand All @@ -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 }}
Expand Down

0 comments on commit ef8d9cc

Please sign in to comment.