Skip to content

Commit

Permalink
Zip archive release support
Browse files Browse the repository at this point in the history
Add support of zipping an artifact directory before releasing.
  • Loading branch information
syncom committed May 20, 2024
1 parent bb3e520 commit 428a60f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
- 'main'

jobs:
test_ota_release:
name: 'Test OTA Release Action'
test_ota_release_file:
name: 'Test OTA Release Action (release_type: file)'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout'
Expand All @@ -36,3 +36,31 @@ jobs:
signing_key_management: 'local'
signing_key: ${{ secrets.TEST_SIGNING_KEY }}
signing_key_password: ${{ secrets.TEST_SIGNING_KEY_PASSWORD }}

test_ota_release_zip_archive:
name: 'Test OTA Release Action (release_type: zip_archive)'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v4'

- name: 'Create artifacts for test'
run: |
mkdir -p artifacts
hello_time="$(date +'%Y-%m-%dT%H:%M:%S%z')"
echo "${hello_time}: Hello, World!" > artifacts/hello.txt
sleep 4.2
goodbye_time="$(date +'%Y-%m-%dT%H:%M:%S%z')"
echo "${goodbye_time}: Goodbye, World!" > artifacts/goodbye.txt
- name: 'Test OTA Release'
uses: './' # Use an action in the root directory
with:
release_type: 'zip_archive'
persist_dir: '/tmp/persist'
zip_archive_dir: 'artifacts'
base_install_path_on_device: '/tmp/ota'
project_access_token: ${{ secrets.TEST_PROJECT_ACCESS_TOKEN }}
signing_key_management: 'local'
signing_key: ${{ secrets.TEST_SIGNING_KEY }}
signing_key_password: ${{ secrets.TEST_SIGNING_KEY_PASSWORD }}
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ inputs:
description: 'Path to the rootfs image file. Required only if release_type is "rootfs"'
required: false
default: ''
zip_archive_path:
description: 'Path to the zip archive file. Required only if release_type is "zip_archive"'
zip_archive_dir:
description: 'Path to the directory whose content will be zipped before releasing. Required only if release_type is "zip_archive"'
required: false
default: ''
base_install_path_on_device:
Expand Down
10 changes: 7 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# INPUT_PERSIST_DIR
# INPUT_ARTIFACTS_DIR
# INPUT_ROOTFS_IMG_PATH
# INPUT_ZIP_ARCHIVE_PATH
# INPUT_ZIP_ARCHIVE_DIR
# INPUT_BASE_INSTALL_PATH_ON_DEVICE
# INPUT_PROJECT_ACCESS_TOKEN
# INPUT_SIGNING_KEY_MANAGEMENT
Expand Down Expand Up @@ -56,12 +56,12 @@ get_manifest_template_hack() {
file_release() {
get_manifest_template_hack

local artifacts_dir="${INPUT_ARTIFACTS_DIR:-}"
local zip_archive_dir="${INPUT_ZIP_ARCHIVE_DIR:-}"
local base_install_path="${INPUT_BASE_INSTALL_PATH_ON_DEVICE:-}"
[ -z "${artifacts_dir}" ] && err "No artifacts directory provided"
[ -z "${base_install_path}" ] && err "No base install path provided"

"${TRH_BINARY_PATH}" prepare --target="${artifacts_dir}" --file-base-path="${base_install_path}"
"${TRH_BINARY_PATH}" prepare --zip-target --target="${zip_archive_dir}" --file-base-path="${base_install_path}"

"${TRH_BINARY_PATH}" release

Expand All @@ -80,6 +80,10 @@ zip_archive_release() {
local base_install_path="${INPUT_BASE_INSTALL_PATH_ON_DEVICE:-}"
[ -z "${artifacts_dir}" ] && err "No artifacts directory provided"
[ -z "${base_install_path}" ] && err "No base install path provided"

"${TRH_BINARY_PATH}" prepare --target="${artifacts_dir}" --file-base-path="${base_install_path}"

"${TRH_BINARY_PATH}" release
}

do_it() {
Expand Down

0 comments on commit 428a60f

Please sign in to comment.