diff --git a/.github/workflows/node.yaml b/.github/workflows/node.yaml index c09227e..d52ce93 100644 --- a/.github/workflows/node.yaml +++ b/.github/workflows/node.yaml @@ -294,6 +294,9 @@ jobs: runs-on: ubuntu-latest name: build image + needs: + - Linux-arm64 + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false @@ -304,6 +307,18 @@ jobs: with: fetch-depth: 0 + - name: Determine files to upload + id: filenames + shell: bash + run: | + HASH=$(git rev-parse --short HEAD) + COUNT=$(git rev-list --count HEAD) + VERSION=$(node -e "console.log(require('./package.json').version)") + + echo "sourcename=pi-image/output-satellitepi/image.gz" >> $GITHUB_OUTPUT + echo "targetname=companion-satellite-pi-${COUNT}-${HASH}.img.gz" >> $GITHUB_OUTPUT + echo "longversion=${VERSION}+${COUNT}-${HASH}" >> $GITHUB_OUTPUT + - name: install packer run: | curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - @@ -314,7 +329,7 @@ jobs: run: | cd pi-image sudo packer init satellitepi.pkr.hcl - sudo packer build --var branch=${GITHUB_REF_NAME} satellitepi.pkr.hcl + sudo packer build --var branch=${GITHUB_REF_NAME} --var "build=${{ steps.filenames.outputs.longversion }}" satellitepi.pkr.hcl env: PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -330,18 +345,6 @@ jobs: sudo gzip -n image - - name: Determine files to upload - id: filenames - shell: bash - run: | - HASH=$(git rev-parse --short HEAD) - COUNT=$(git rev-list --count HEAD) - VERSION=$(node -e "console.log(require('./package.json').version)") - - echo "sourcename=pi-image/output-satellitepi/image.gz" >> $GITHUB_OUTPUT - echo "targetname=companion-satellite-pi-${COUNT}-${HASH}.img.gz" >> $GITHUB_OUTPUT - echo "longversion=${VERSION}+${COUNT}-${HASH}" >> $GITHUB_OUTPUT - - name: Upload build uses: bitfocus/actions/upload-and-notify@main with: diff --git a/pi-image/install.sh b/pi-image/install.sh index e014194..045bcb1 100644 --- a/pi-image/install.sh +++ b/pi-image/install.sh @@ -54,12 +54,11 @@ git config --global pull.rebase false # run the update script -if [ "$SATELLITE_BUILD" == "beta" ] || [ "$SATELLITE_BUILD" == "experimental" ]; then - ./pi-image/update.sh beta +if [ "$SATELLITE_BRANCH" == "main" ]; then + ./pi-image/update.sh beta "$SATELLITE_BUILD" else ./pi-image/update.sh stable "$SATELLITE_BUILD" fi -# ./pi-image/update.sh $SATELLITE_BRANCH # install update script dependencies, as they were ignored yarn --cwd "/usr/local/src/companion-satellite/update-prompt" install diff --git a/pi-image/satellitepi.pkr.hcl b/pi-image/satellitepi.pkr.hcl index 56c8465..ec4f470 100644 --- a/pi-image/satellitepi.pkr.hcl +++ b/pi-image/satellitepi.pkr.hcl @@ -12,6 +12,11 @@ variable "branch" { default = "main" } +variable "build" { + type = string + default = "beta" +} + source "arm-image" "satellitepi" { iso_checksum = "sha256:9ce5e2c8c6c7637cd2227fdaaf0e34633e6ebedf05f1c88e00f833cbb644db4b" iso_url = "https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2023-12-11/2023-12-11-raspios-bookworm-arm64-lite.img.xz" @@ -48,6 +53,7 @@ build { # run the script "export SATELLITE_BRANCH=${var.branch}", + "export SATELLITE_BUILD=${var.build}", "chmod +x /tmp/install.sh", "/tmp/install.sh" ]