Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use docker to build images (#16) #29

Merged
merged 11 commits into from
Mar 12, 2024
43 changes: 26 additions & 17 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ inputs:
Example: `ublue-os`
required: false
default: ${{ github.repository_owner }}

runs:
using: "composite"
steps:
Expand All @@ -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
gmpinder marked this conversation as resolved.
Show resolved Hide resolved
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 \
xynydev marked this conversation as resolved.
Show resolved Hide resolved
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/[email protected]

# 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
Expand All @@ -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}}