Skip to content

Commit

Permalink
Create workflow to build and deploy balenaOS
Browse files Browse the repository at this point in the history
Change-type: minor
Signed-off-by: Kyle Harding <[email protected]>
  • Loading branch information
klutchell committed Feb 13, 2024
1 parent 0cb57ae commit 1156684
Show file tree
Hide file tree
Showing 3 changed files with 733 additions and 0 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/dispatch-yocto-build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: "Call Yocto Build and Deploy Workflow"

on:
pull_request:
types: [opened, synchronize]
branches:
- "main"
- "master"
pull_request_target:
types: [opened, synchronize]
branches:
- "main"
- "master"

workflow_dispatch:
# you may only define up to 10 `inputs` for a `workflow_dispatch` event
inputs:
device-repo:
description: balenaOS device repository (owner/repo)
required: true
type: string
default: balena-os/balena-generic
device-repo-ref:
description: balenaOS device repository tag, branch, or commit to build
required: false
type: string
default: master
meta-balena-ref:
description: meta-balena ref if not the currently pinned version
required: false
type: string
yocto-scripts-ref:
description: balena-yocto-scripts ref if not the currently pinned version
required: false
type: string
machine:
description: yocto board name
required: true
type: string
default: generic-amd64
environment:
description: Select deploy environment
required: false
type: choice
options:
- >
{
"environment": "balena-staging.com",
"s3-bucket": "resin-staging-img",
"s3-region": "us-east-1",
"aws-subnet": "subnet-0d73c1f0da85add17",
"aws-security-group": "sg-09dd285d11b681946"
}
- >
{
"environment": "balena-cloud.com",
"s3-bucket": "resin-production-img-cloudformation",
"s3-region": "us-east-1",
"aws-subnet": "subnet-02d18a08ea4058574",
"aws-security-group": "sg-057937f4d89d9d51c"
}
deploy-s3:
description: Whether to deploy images to S3
required: false
type: boolean
default: true
deploy-hostapp:
description: Whether to deploy a hostApp container image to a balena environment
required: false
type: boolean
default: true
deploy-ami:
description: Whether to deploy an AMI to AWS
required: false
type: boolean
default: false
sign-image:
description: Whether to sign image for secure boot
required: false
type: boolean
default: false
# do-esr:
# description: Enable to deploy ESR
# required: false
# type: boolean
# default: false

jobs:
yocto-build-deploy:
name: Yocto Build and Deploy
uses: ./.github/workflows/yocto-build-deploy.yml
# prevent duplicate workflow executions for pull_request and pull_request_target
if: |
(
github.event.pull_request.head.repo.full_name == github.repository &&
github.event_name == 'pull_request'
) || (
github.event.pull_request.head.repo.full_name != github.repository &&
github.event_name == 'pull_request_target'
)
secrets: inherit
with:
device-repo: ${{ inputs.device-repo || 'balena-generic' }}
device-repo-ref: ${{ inputs.device-repo-ref || 'master' }}
meta-balena-ref: ${{ inputs.meta-balena-ref }}
yocto-scripts-ref: ${{ inputs.yocto-scripts-ref }}
machine: ${{ inputs.machine || 'generic-amd64' }}
balena-environment: ${{ fromJSON(inputs.environment || '{}').environment || 'balena-cloud.com' }}
s3-region: ${{ fromJSON(inputs.environment || '{}').s3-region || 'us-east-1' }}
s3-bucket: ${{ fromJSON(inputs.environment || '{}').s3-bucket || 'resin-staging-img' }}
aws-subnet: ${{ fromJSON(inputs.environment || '{}').aws-subnet || 'subnet-0d73c1f0da85add17' }}
aws-security-group: ${{ fromJSON(inputs.environment || '{}').aws-security-group || 'sg-09dd285d11b681946' }}
deploy-s3: ${{ inputs.deploy-s3 || false }}
deploy-hostapp: ${{ inputs.deploy-hostapp || false }}
deploy-ami: ${{ inputs.deploy-ami || false }}
sign-image: ${{ inputs.sign-image || false }}
do-esr: ${{ inputs.do-esr || false }}
Loading

0 comments on commit 1156684

Please sign in to comment.