Managed to get it working… It requires an additional job at the end of the action. Also, pay attention to the openbalena env id (env rename 4 ${{ github.sha }}
, you need to retrieve the correct ID from the CLI).
This adds the entire SHA which is pretty long, so there is the optional job (#2) to shorten it - to use just uncomment.
name: OpenBalena Deploy
on:
push:
branches:
- master
jobs:
balena-deploy:
runs-on: self-hosted
steps:
- name: git-checkout
uses: actions/checkout@v2
# - name: Add SHORT_SHA env property with commit short sha
# run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
- name: balena-deploy
uses: Solar-Control/open-balena-cli-action@v2.0.0
if: success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
open_balena_address: ${{secrets.OPEN_BALENA_ADDRESS}}
root_cert: ${{secrets.OPEN_BALENA_ROOT_CERT}}
balena_command: "deploy ${{secrets.BALENA_APPLICATION}} --logs"
- name: balena-env-rename
uses: Solar-Control/open-balena-cli-action@v2.0.0
if: success()
with:
balena_api_token: ${{secrets.BALENA_API_TOKEN}}
open_balena_address: ${{secrets.OPEN_BALENA_ADDRESS}}
root_cert: ${{secrets.OPEN_BALENA_ROOT_CERT}}
balena_command: "env rename 4 ${{ github.sha }}"