Skip to content

Commit

Permalink
yocto-build-deploy.yml: Update to use the v7 balena-cloud model
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
thgreasi committed Dec 12, 2024
1 parent 7a7fde8 commit 8dd5d9b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/yocto-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ jobs:
id: balena-lib
env:
CURL: "curl --silent --retry 10 --location --compressed"
TRANSLATION: "v6"
TRANSLATION: "v7"
BALENAOS_TOKEN: ${{ secrets.BALENA_API_DEPLOY_KEY }}
run: |
source "${automation_dir}/include/balena-api.inc"
Expand Down Expand Up @@ -700,7 +700,7 @@ jobs:
META_BALENA_VERSION: "${{ steps.balena-lib.outputs.meta_balena_version }}"
RELEASE_VERSION: "${{ steps.balena-lib.outputs.os_version }}"
BOOTABLE: 1
TRANSLATION: "v6"
TRANSLATION: "v7"
FINAL: ${{ steps.should-finalize.outputs.finalize }}
ESR: "${{ steps.esr-check.outputs.is-esr }}"
balenaCloudEmail: # TODO: currently trying to use named API key only, its possible email/pw auth no longer has the additional privileges that it used to
Expand Down Expand Up @@ -755,9 +755,14 @@ jobs:
_orgID=$(echo "${_json}" | jq --raw-output '.d[0].id' || true)
echo "${_orgID}"
echo "Fetching ${SLUG} device type id"
_json=$(${CURL} -XGET "https://api.${API_ENV}/${TRANSLATION}/device_type(slug='${SLUG}')?\$select=id" -H "Content-Type: application/json" -H "Authorization: Bearer ${BALENAOS_TOKEN}")
_deviceTypeID=$(echo "${_json}" | jq --raw-output '.d[0].id' || true)
echo "${_deviceTypeID}"
# https://github.com/balena-os/balena-yocto-scripts/blob/master/automation/include/balena-api.inc#L128
echo "Creating App"
_json=$(${CURL} -XPOST "https://api.${API_ENV}/${TRANSLATION}/application" -H "Content-Type: application/json" -H "Authorization: Bearer ${BALENAOS_TOKEN}" --data "{\"organization\": \"${_orgID}\", \"app_name\": \"${APPNAME}\", \"device_type\": \"${SLUG}\"}")
_json=$(${CURL} -XPOST "https://api.${API_ENV}/${TRANSLATION}/application" -H "Content-Type: application/json" -H "Authorization: Bearer ${BALENAOS_TOKEN}" --data "{\"organization\": \"${_orgID}\", \"app_name\": \"${APPNAME}\", \"is_of__device_type\": \"${_deviceTypeID}\"}")
_appID=$(echo "${_json}" | jq --raw-output '.id' || true)
echo "${_appID}"
Expand Down Expand Up @@ -871,7 +876,7 @@ jobs:
for _asset in ${_assets}; do
if [ -f "${_asset}" ]; then
_asset_key=$(basename "${_asset}")
# note: this uses the "resin" endpoint rather than v6
# note: this uses the "resin" endpoint rather than v7
_json=$(${CURL} -XPOST "https://api.${API_ENV}/resin/release_asset" -H "Authorization: Bearer ${BALENAOS_TOKEN}" --form "release=${_release_id}" --form "asset_key=${_asset_key}" --form "asset=@${_asset}")
_aid=$(echo "${_json}" | jq -r '.id')
echo "${_aid}"
Expand All @@ -891,7 +896,7 @@ jobs:
SLUG: "${{ steps.balena-lib.outputs.device_slug }}"
APPNAME: "${{ steps.balena-lib.outputs.device_slug }}-esr"
META_BALENA_VERSION: "${{ steps.balena-lib.outputs.meta_balena_version }}"
TRANSLATION: "v6"
TRANSLATION: "v7"
CURL: "curl --silent --retry 10 --location --compressed"
VERSION: ${{ steps.balena-lib.outputs.os_version }}
HOSTAPP_RELEASE_ID: ${{ steps.deploy-hostapp.outputs.release_id }}
Expand Down

0 comments on commit 8dd5d9b

Please sign in to comment.