Attempting to use custom action #27

Closed
eriq12 wants to merge 16 commits from custom-action into main
2 changed files with 225 additions and 4 deletions
Showing only changes of commit b309edb692 - Show all commits

View File

@@ -36,6 +36,13 @@ inputs:
Disable this with 'false' if your image doesn't take up a lot of space and you'd rather have shorter build times. Disable this with 'false' if your image doesn't take up a lot of space and you'd rather have shorter build times.
required: false required: false
default: "true" default: "true"
use_unstable_cli:
description: |
If true, this action pulls the `main` branch of blue-build/cli instead of the stable version the current action version is configured to use by default.
This feature is useful for testing new features, but should not be used in production.
Input must match the string 'true' for the unstable version to be used.
required: false
default: "false"
cli_version: cli_version:
description: | description: |
Set this with a tag, sha, or branch name for the blue-build/cli repo to use that particular version of the CLI tool. This will override the `use_unstable_cli` input for the action. Set this with a tag, sha, or branch name for the blue-build/cli repo to use that particular version of the CLI tool. This will override the `use_unstable_cli` input for the action.
@@ -44,7 +51,7 @@ inputs:
description: | description: |
The container registry to push the built image to. The container registry to push the built image to.
required: false required: false
default: "git.hydrosaber.com" default: "ghcr.io"
registry_namespace: registry_namespace:
description: | description: |
The namespace on the registry to push to. The namespace on the registry to push to.
@@ -52,6 +59,15 @@ inputs:
Example: `ublue-os` Example: `ublue-os`
required: false required: false
default: ${{ github.repository_owner }} default: ${{ github.repository_owner }}
rechunk:
description: |
Rechunk the ostree-based result images with [github.com/hhd-dev/rechunk](https://github.com/hhd-dev/rechunk) for more efficient diffs and updates. (lower image size, better download speed, better update resuming)
Will make your builds considerably slower. This is an experimental option, as it can cause issues with file permissions in some scenarios, so enable on your own risk.
Internally builds squashed images with podman to further reduce the image size.
required: false
default: "false"
use_cache: use_cache:
description: | description: |
Make use of layer cache by pushing the layers to the registry. Input must match the string 'true' for the step to be enabled. Make use of layer cache by pushing the layers to the registry. Input must match the string 'true' for the step to be enabled.
@@ -99,6 +115,14 @@ runs:
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
if: ${{ inputs.maximize_build_space == 'true' }} if: ${{ inputs.maximize_build_space == 'true' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@18ce135bb5112fa8ce4ed6c17ab05699d7f3a5e0 # v3.11.0
if: ${{ inputs.squash != 'true' && inputs.rechunk != 'true' }}
with:
install: true
driver: docker-container
cache-binary: ${{ inputs.use_cache }}
- name: Get Ubuntu version - name: Get Ubuntu version
id: ubuntu_version id: ubuntu_version
shell: bash shell: bash
@@ -109,6 +133,7 @@ runs:
# that is compatible with BlueBuild # that is compatible with BlueBuild
- name: Setup Podman - name: Setup Podman
if: ${{ (inputs.squash == 'true' || inputs.rechunk == 'true') && steps.ubuntu_version.outputs.version == '22.04' }}
shell: bash shell: bash
run: | run: |
# from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04 # from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04
@@ -135,7 +160,9 @@ runs:
env: env:
RECIPE: ${{ inputs.recipe }} RECIPE: ${{ inputs.recipe }}
run: | run: |
if [ -n "${{ inputs.cli_version }}" ]; then if [[ "${{ inputs.use_unstable_cli }}" == "true" && -z "${{ inputs.cli_version }}" ]]; then
CLI_VERSION_TAG="main"
elif [ -n "${{ inputs.cli_version }}" ]; then
CLI_VERSION_TAG="${{ inputs.cli_version }}" CLI_VERSION_TAG="${{ inputs.cli_version }}"
else else
CLI_VERSION_TAG="v0.9" CLI_VERSION_TAG="v0.9"
@@ -180,4 +207,18 @@ runs:
CLICOLOR_FORCE: "1" CLICOLOR_FORCE: "1"
BUILD_OPTS: ${{ inputs.build_opts }} BUILD_OPTS: ${{ inputs.build_opts }}
run: | run: |
sudo -E bluebuild build -v --push --rechunk ${BUILD_OPTS} ${RECIPE_PATH} if [ "${{ inputs.squash }}" = "true" ]; then
BUILD_OPTS="--build-driver podman --squash $BUILD_OPTS"
fi
RUN_SUDO=""
if [ "${{ inputs.rechunk }}" = "true" ]; then
RUN_SUDO=1
BUILD_OPTS="--rechunk $BUILD_OPTS"
fi
if [ -n "$RUN_SUDO" ]; then
sudo -E bluebuild build -v --push ${BUILD_OPTS} ${RECIPE_PATH}
else
bluebuild build -v --push ${BUILD_OPTS} ${RECIPE_PATH}
fi