Skip to content

Commit

Permalink
feat: api versions support (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau authored Feb 9, 2022
1 parent b17cea9 commit d9e5973
Show file tree
Hide file tree
Showing 8 changed files with 472 additions and 406 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
- '**'

env:
BEE_VERSION: '1.4.1-238867f1-stateful'
BLOCKCHAIN_VERSION: '1.2.0-for-1.4.1-238867f1-stateful'
BEE_VERSION: '1.4.3-1213e063-stateful'
BLOCKCHAIN_VERSION: '1.2.0-for-1.4.3-1213e063-stateful'
BEE_ENV_PREFIX: 'swarm-test'
BEE_IMAGE_PREFIX: 'docker.pkg.github.com/ethersphere/bee-factory'
COMMIT_VERSION_TAG: 'false'
Expand Down
56 changes: 49 additions & 7 deletions .github/workflows/update_bee.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
beeFactoryImageVersion:
description: 'Bee Factory image version (eq. 1.3.0-fd09d1c4-stateful)'
required: true
beeApiVersion:
description: 'Bee API version (eq. 1.3.0)'
required: true
beeDebugApiVersion:
description: 'Bee Debug API version (eq. 1.3.0)'
required: true

repository_dispatch:
types: [update-bee]
Expand All @@ -23,14 +29,20 @@ jobs:
run: |
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
image_version="${{ github.event.client_payload.imageVersion }}"
bee_api_version="${{ github.event.client_payload.apiVersion }}"
bee_debug_api_version="${{ github.event.client_payload.debugApiVersion }}"
else
image_version="${{ github.event.inputs.beeFactoryImageVersion }}"
bee_api_version="${{ github.event.inputs.beeApiVersion }}"
bee_debug_api_version="${{ github.event.inputs.beeDebugApiVersion }}"
fi
bee_version=${image_version/-stateful}
echo "IMAGE_VERSION=$image_version" >> $GITHUB_ENV
echo "BEE_VERSION=$bee_version" >> $GITHUB_ENV
echo "TARGET_BRANCH=${bee_version/-rc*}" >> $GITHUB_ENV
echo "API_VERSION=$bee_api_version" >> $GITHUB_ENV
echo "DEBUG_API_VERSION=$bee_debug_api_version" >> $GITHUB_ENV
- name: Replace Engine in package.json
uses: jossef/action-set-json-field@v1
Expand All @@ -39,22 +51,52 @@ jobs:
field: engines.bee
value: ${{ env.BEE_VERSION }}

- name: Replace BEE_VERSION for CI
uses: jacobtomlinson/gha-find-replace@v2
- name: Replace API version in package.json
uses: jossef/action-set-json-field@v1
with:
find: "BEE_VERSION: '.*?'"
replace: "BEE_VERSION: '${{ env.IMAGE_VERSION }}'"
include: ".github/workflows/tests.yaml"
regex: true
file: package.json
field: engines.beeApiVersion
value: ${{ env.API_VERSION }}

- name: Replace Debug API version in package.json
uses: jossef/action-set-json-field@v1
with:
file: package.json
field: engines.beeDebugApiVersion
value: ${{ env.DEBUG_API_VERSION }}

- name: Replace SUPPORTED_BEE_VERSION_EXACT for Status module
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "export const SUPPORTED_BEE_VERSION_EXACT = '.*?'"
replace: "export const SUPPORTED_BEE_VERSION_EXACT = '${{ env.IMAGE_VERSION }}'"
replace: "export const SUPPORTED_BEE_VERSION_EXACT = '${{ env.BEE_VERSION }}'"
include: "src/modules/debug/status.ts"
regex: true

- name: Replace SUPPORTED_API_VERSION for Status module
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "export const SUPPORTED_API_VERSION = '.*?'"
replace: "export const SUPPORTED_API_VERSION = '${{ env.API_VERSION }}'"
include: "src/modules/debug/status.ts"
regex: true

- name: Replace SUPPORTED_DEBUG_API_VERSION for Status module
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "export const SUPPORTED_DEBUG_API_VERSION = '.*?'"
replace: "export const SUPPORTED_DEBUG_API_VERSION = '${{ env.DEBUG_API_VERSION }}'"
include: "src/modules/debug/status.ts"
regex: true

- name: Replace BEE_VERSION for CI
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "BEE_VERSION: '.*?'"
replace: "BEE_VERSION: '${{ env.IMAGE_VERSION }}'"
include: ".github/workflows/tests.yaml"
regex: true

- name: Replace BLOCKCHAIN_VERSION for CI
uses: jacobtomlinson/gha-find-replace@v2
with:
Expand Down
Loading

0 comments on commit d9e5973

Please sign in to comment.