sets image name in abroot config automatically
This commit is contained in:
parent
c6d68b4b79
commit
8a6475dedd
5 changed files with 25 additions and 1 deletions
12
.github/workflows/vib-build.yml
vendored
12
.github/workflows/vib-build.yml
vendored
|
|
@ -15,6 +15,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
has_updates: ${{ steps.set_output.outputs.has_updates }}
|
has_updates: ${{ steps.set_output.outputs.has_updates }}
|
||||||
|
base_image_type: ${{ steps.read_base_recipe.outputs.base_image_type }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -25,10 +26,13 @@ jobs:
|
||||||
run: sudo apt-get install jq
|
run: sudo apt-get install jq
|
||||||
|
|
||||||
- name: Read base image name from recipe
|
- name: Read base image name from recipe
|
||||||
|
id: read_base_recipe
|
||||||
run: |
|
run: |
|
||||||
BASE_IMAGE="$(cat recipe.yml | grep "ghcr.io/vanilla-os" | awk -F ' ' '{print $2}')"
|
BASE_IMAGE="$(cat recipe.yml | grep "ghcr.io/vanilla-os" | awk -F ' ' '{print $2}')"
|
||||||
echo The base image is $BASE_IMAGE
|
echo The base image is $BASE_IMAGE
|
||||||
echo "BASE_IMAGE_TYPE=$(echo $BASE_IMAGE | awk -F '/' '{print $3}' | awk -F ':' '{print $1}')" >> "$GITHUB_ENV"
|
BASE_IMAGE_TYPE="$(echo $BASE_IMAGE | awk -F '/' '{print $3}' | awk -F ':' '{print $1}')"
|
||||||
|
echo "base_image_type=$BASE_IMAGE_TYPE" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "BASE_IMAGE_TYPE=$BASE_IMAGE_TYPE" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: get last successful run
|
- name: get last successful run
|
||||||
if: ${{ github.ref_type == 'branch' }}
|
if: ${{ github.ref_type == 'branch' }}
|
||||||
|
|
@ -96,8 +100,14 @@ jobs:
|
||||||
- name: generate image name
|
- name: generate image name
|
||||||
run: |
|
run: |
|
||||||
REPO_OWNER_LOWERCASE="$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')"
|
REPO_OWNER_LOWERCASE="$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')"
|
||||||
|
echo "REPO_OWNER_LOWERCASE=$REPO_OWNER_LOWERCASE">> "$GITHUB_ENV"
|
||||||
echo "IMAGE_TAG=ghcr.io/$REPO_OWNER_LOWERCASE/${{ env.CUSTOM_IMAGE_NAME }}:main">> "$GITHUB_ENV"
|
echo "IMAGE_TAG=ghcr.io/$REPO_OWNER_LOWERCASE/${{ env.CUSTOM_IMAGE_NAME }}:main">> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Set image info
|
||||||
|
run: |
|
||||||
|
echo -n "vanilla-os/${{ needs.check_update.outputs.base_image_type }}" > ./includes.container/image-info/base-image-name
|
||||||
|
echo -n "${{ env.REPO_OWNER_LOWERCASE }}/${{ env.CUSTOM_IMAGE_NAME }}" > ./includes.container/image-info/image-name
|
||||||
|
|
||||||
- name: Build the Docker image
|
- name: Build the Docker image
|
||||||
run: docker image build -f Containerfile --tag "${{ env.IMAGE_TAG }}" .
|
run: docker image build -f Containerfile --tag "${{ env.IMAGE_TAG }}" .
|
||||||
|
|
||||||
|
|
|
||||||
1
includes.container/image-info/base-image-name
Normal file
1
includes.container/image-info/base-image-name
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
This will be replaced by the github workflow to what is set in the recipe. For example: vanilla-os/desktop
|
||||||
1
includes.container/image-info/image-name
Normal file
1
includes.container/image-info/image-name
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
This will be replaced by the github workflow to what is set in the workflow. For example: taukakao/custom
|
||||||
11
modules/80-set-image-abroot-config.yml
Normal file
11
modules/80-set-image-abroot-config.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
name: add-image-name
|
||||||
|
type: shell
|
||||||
|
commands:
|
||||||
|
- BASE_IMAGE="$(cat /image-info/base-image-name)"
|
||||||
|
- IMAGE_NAME="$(cat /image-info/image-name)"
|
||||||
|
- echo base image "$BASE_IMAGE"
|
||||||
|
- echo custom image name "$IMAGE_NAME"
|
||||||
|
- BASE_IMAGE_ESCAPED="$(echo $BASE_IMAGE | sed 's/\//\\\//g')"
|
||||||
|
- IMAGE_NAME_ESCAPED="$(echo $IMAGE_NAME | sed 's/\//\\\//g')"
|
||||||
|
- sed -i "s/$BASE_IMAGE_ESCAPED/$IMAGE_NAME_ESCAPED/g" /usr/share/abroot/abroot.json
|
||||||
|
- rm -rf /image-info
|
||||||
|
|
@ -30,6 +30,7 @@ modules:
|
||||||
type: includes
|
type: includes
|
||||||
includes:
|
includes:
|
||||||
- modules/50-install-debs
|
- modules/50-install-debs
|
||||||
|
- modules/80-set-image-abroot-config
|
||||||
|
|
||||||
# Put your custom actions before this comment
|
# Put your custom actions before this comment
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue