Refactor make_ext2_workflow_inputs
This commit is contained in:
parent
eed08ca1d7
commit
8c6537e2a6
36
.github/workflows/build_and_deploy_ext2_img.yml
vendored
36
.github/workflows/build_and_deploy_ext2_img.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Create and deploy ext2 image to pages
|
name: Deploy
|
||||||
|
|
||||||
# Define when the workflow should run
|
# Define when the workflow should run
|
||||||
on:
|
on:
|
||||||
@ -9,33 +9,21 @@ on:
|
|||||||
inputs:
|
inputs:
|
||||||
DOCKERFILE_PATH:
|
DOCKERFILE_PATH:
|
||||||
type: string
|
type: string
|
||||||
description: 'Absolute path to the Dockerfile. The Docker build context is the repository root.'
|
description: 'Absolute path to the Dockerfile.'
|
||||||
required: true
|
required: true
|
||||||
default: 'dockerfiles/example/Dockerfile'
|
default: 'dockerfiles/example/Dockerfile'
|
||||||
|
|
||||||
IMAGE_SIZE:
|
IMAGE_SIZE:
|
||||||
type: string
|
type: string
|
||||||
description: 'Size of the base ext2 image. 950GB is the max size for Github pages, 2GB for Github release. Refer to the fallocate(1) manpage for multiplicative suffixes'
|
description: 'Image size, 950MB max.'
|
||||||
required: true
|
required: true
|
||||||
default: '600MB'
|
default: '600MB'
|
||||||
|
|
||||||
IMAGE_NAME:
|
LOGIN_UGID:
|
||||||
type: string
|
type: string
|
||||||
description: 'Name of final image. Example final url: https://www.github.io/<owner>/<repositoryName>/<image_name>'
|
description: 'UID:GID of the starting process.'
|
||||||
required: true
|
required: true
|
||||||
default: 'base_image.ext2'
|
default: "1000:1000"
|
||||||
|
|
||||||
LOGIN_UID:
|
|
||||||
type: string
|
|
||||||
description: 'UID of the starting process.'
|
|
||||||
required: true
|
|
||||||
default: "1000"
|
|
||||||
|
|
||||||
LOGIN_GID:
|
|
||||||
type: string
|
|
||||||
description: 'GID of the starting process.'
|
|
||||||
required: true
|
|
||||||
default: "1000"
|
|
||||||
|
|
||||||
DEPLOY_TO_GITHUB_PAGES:
|
DEPLOY_TO_GITHUB_PAGES:
|
||||||
type: boolean
|
type: boolean
|
||||||
@ -63,7 +51,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
TAG: "ext2-webvm-base-image" # Tag of docker image.
|
TAG: "ext2-webvm-base-image" # Tag of docker image.
|
||||||
IMAGE_SIZE: '${{ github.event.inputs.IMAGE_SIZE }}'
|
IMAGE_SIZE: '${{ github.event.inputs.IMAGE_SIZE }}'
|
||||||
IMAGE_NAME: '${{ github.event.inputs.IMAGE_NAME }}'
|
|
||||||
DEPLOY_DIR: /webvm_deploy/ # Path to directory where we host the final image from.
|
DEPLOY_DIR: /webvm_deploy/ # Path to directory where we host the final image from.
|
||||||
|
|
||||||
permissions: # Permissions to grant the GITHUB_TOKEN.
|
permissions: # Permissions to grant the GITHUB_TOKEN.
|
||||||
@ -86,6 +73,13 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }} # As required by the GitHub-CLI
|
GH_TOKEN: ${{ github.token }} # As required by the GitHub-CLI
|
||||||
|
|
||||||
|
# Setting the IMAGE_NAME env to <Dockerfile name>_<date>_<run_id>.ext2.
|
||||||
|
- run: echo "IMAGE_NAME=$(basename ${{ github.event.inputs.DOCKERFILE_PATH }})_$(date +%Y%m%d)_${{ github.run_id }}.ext2" >> $GITHUB_ENV
|
||||||
|
# We extract the uid and gid from the uid:gid input.
|
||||||
|
- run: |
|
||||||
|
echo "LOGIN_UID=$(echo ${{ github.event.inputs.LOGIN_UGID }} | cut -d ':' -f1)" >> $GITHUB_ENV
|
||||||
|
echo "LOGIN_GID=$(echo ${{ github.event.inputs.LOGIN_UGID }} | cut -d ':' -f2)" >> $GITHUB_ENV
|
||||||
|
|
||||||
# Create directory to host the image from.
|
# Create directory to host the image from.
|
||||||
- run: sudo mkdir -p $DEPLOY_DIR
|
- run: sudo mkdir -p $DEPLOY_DIR
|
||||||
|
|
||||||
@ -124,8 +118,8 @@ jobs:
|
|||||||
# 3. Replaces all occurrences of DEVICE_TYPE to bytes.
|
# 3. Replaces all occurrences of DEVICE_TYPE to bytes.
|
||||||
- name: Adjust index.html
|
- name: Adjust index.html
|
||||||
run: |
|
run: |
|
||||||
sudo sed -i 's#UID#"${{ github.event.inputs.LOGIN_UID }}"#g' ${{ env.DEPLOY_DIR }}index.html
|
sudo sed -i 's#UID#"${{ env.LOGIN_UID }}"#g' ${{ env.DEPLOY_DIR }}index.html
|
||||||
sudo sed -i 's#GID#"${{ github.event.inputs.LOGIN_GID }}"#g' ${{ env.DEPLOY_DIR }}index.html
|
sudo sed -i 's#GID#"${{ env.LOGIN_GID }}"#g' ${{ env.DEPLOY_DIR }}index.html
|
||||||
sudo sed -i 's#IMAGE_URL#"${{ env.IMAGE_NAME }}"#g' ${{ env.DEPLOY_DIR }}index.html
|
sudo sed -i 's#IMAGE_URL#"${{ env.IMAGE_NAME }}"#g' ${{ env.DEPLOY_DIR }}index.html
|
||||||
sudo sed -i 's#DEVICE_TYPE#"bytes"#g' ${{ env.DEPLOY_DIR }}index.html
|
sudo sed -i 's#DEVICE_TYPE#"bytes"#g' ${{ env.DEPLOY_DIR }}index.html
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user