From 3475a0c8e793c7460b42f62c2d970edf2e3918b6 Mon Sep 17 00:00:00 2001 From: gerblesh <101901964+gerblesh@users.noreply.github.com> Date: Tue, 12 Mar 2024 05:46:39 -0700 Subject: [PATCH] fix: use docker to build images (#16) (#29) * feat: use docker build from `testing` branch changes were made in the `testing` branch however the main branch hasn't been updated with docker builds. This PR includes the changes to build with docker and use a cache into the `main` version of the action * fix: add use_cache input * docs: document "Expose Github Runtime" * fix: add cosign installer * Update action.yml Co-authored-by: Gerald Pinder * Update action.yml Co-authored-by: Gerald Pinder * Update action.yml Co-authored-by: Gerald Pinder * Update action.yml Co-authored-by: Gerald Pinder * Update action.yml Co-authored-by: Gerald Pinder * Make final changes * Go back to using the docker way of installing --------- Co-authored-by: Gerald Pinder --- action.yml | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/action.yml b/action.yml index a1cc489..3b35e5e 100644 --- a/action.yml +++ b/action.yml @@ -50,6 +50,7 @@ inputs: Example: `ublue-os` required: false default: ${{ github.repository_owner }} + runs: using: "composite" steps: @@ -59,13 +60,31 @@ runs: uses: ublue-os/remove-unwanted-software@v6 if: ${{ inputs.maximize_build_space == 'true' }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + install: true + driver: docker + + - name: Install BlueBuild + shell: bash + env: + # Uses GitHubs ternary syntax to set cli version, see https://docs.github.com/en/actions/learn-github-actions/expressions#example + CLI_VERSION_TAG: ${{ inputs.use_unstable_cli == 'true' && 'main' || 'v0.8.2' }} + run: | + docker run \ + --detach \ + --rm \ + --name blue-build-installer \ + ghcr.io/blue-build/cli:${{ env.CLI_VERSION_TAG }}-installer \ + tail -f /dev/null + docker cp blue-build-installer:/out/bluebuild /usr/local/bin/bluebuild + docker stop -t 0 blue-build-installer + # clones user's repo - uses: actions/checkout@v4 + - uses: sigstore/cosign-installer@v3.4.0 - # deps used by cli to build & inspect imaegs - - name: Install Dependencies - shell: bash - run: sudo apt-get install -y podman # blue-build/cli does the heavy lifting - name: Build Image @@ -74,17 +93,7 @@ runs: COSIGN_PRIVATE_KEY: ${{ inputs.cosign_private_key }} GH_TOKEN: ${{ inputs.registry_token }} GH_PR_EVENT_NUMBER: ${{ inputs.pr_event_number }} - # Uses GitHubs ternary syntax to set cli version, see https://docs.github.com/en/actions/learn-github-actions/expressions#example - CLI_VERSION_TAG: ${{ inputs.use_unstable_cli == 'true' && 'main' || 'v0.8.2' }} run: | - podman run \ - -v buildah-vol:/var/run/containerd \ - -v ${PWD}:/bluebuild \ - --env-host \ - --network=host \ - --privileged \ - --device /dev/fuse \ - ghcr.io/blue-build/cli:${CLI_VERSION_TAG}-alpine \ - build -vv --push ./config/${{ inputs.recipe }} \ - --registry ${{ inputs.registry }} \ - --registry-namespace ${{ inputs.registry_namespace }} + bluebuild build -v --push ./config/${{ inputs.recipe }} \ + --registry ${{inputs.registry}} \ + --registry-namespace ${{inputs.registry_namespace}}