Simplify workflow configuration

This commit is contained in:
Alessandro Pignotti 2023-05-19 11:04:40 +02:00
parent 4f490dc153
commit 8e8d77bc6e
3 changed files with 2 additions and 24 deletions

View file

@ -19,12 +19,6 @@ on:
required: true
default: '600M'
LOGIN_UGID:
type: string
description: 'UID:GID of the starting process'
required: true
default: "1000:1000"
DEPLOY_TO_GITHUB_PAGES:
type: boolean
description: 'Deploy to Github pages'
@ -37,12 +31,6 @@ on:
required: true
default: false
GITHUB_RELEASE_TAG:
type: string
description: 'Tag for the GitHub release'
required: true
default: "ext2_image"
jobs:
build:
@ -79,11 +67,6 @@ jobs:
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.
- run: sudo mkdir -p $DEPLOY_DIR
@ -122,13 +105,10 @@ jobs:
sudo split ${{ env.IMAGE_NAME }} ${{ env.DEPLOY_DIR }}/${{ env.IMAGE_NAME }}.c -a 6 -b 128k -x --additional-suffix=.txt
sudo bash -c "stat -c%s ${{ env.IMAGE_NAME }} > ${{ env.DEPLOY_DIR }}/${{ env.IMAGE_NAME }}.meta"
# This step updates the default index.html file by performing the following actions:
# 1. Replaces all occurrences of UID and GID with their respective input parameters.
# 2. Replaces all occurrences of IMAGE_URL with the URL to the image.
# 3. Replaces all occurrences of DEVICE_TYPE to bytes.
- name: Adjust index.html
run: |
sudo sed -i 's#UID#"${{ env.LOGIN_UID }}"#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#DEVICE_TYPE#"split"#g' ${{ env.DEPLOY_DIR }}index.html
@ -157,7 +137,7 @@ jobs:
uses: softprops/action-gh-release@v0.1.15
with:
target_commitish: ${{ github.sha }} # Last commit on the GITHUB_REF branch or tag
tag_name: ${{ github.event.inputs.GITHUB_RELEASE_TAG }} # Tag of the release.
tag_name: ext2_image
fail_on_unmatched_files: 'true' # Fail in case of no matches with the file(s) glob(s).
files: | # Assets to upload as release.
${{ env.IMAGE_NAME }}

View file

@ -43,7 +43,6 @@ From a local `git clone`
- You can also build your own by selecting the "Upload GitHub release" workflow option.
- Place the image in the repository root folder.
- Edit `index.html`
- Replace the `UID`/`GID` variables with `1000`
- Replace `DEVICE_TYPE` with `"bytes"`
- Replace `IMAGE_URL` with the name of the Ext2 image. For example `"debian_mini_20230519_5022088024.ext2"`
- Start a local HTTP server

View file

@ -286,8 +286,7 @@ __ __ _ __ ____ __
consoleDiv.addEventListener("dragleave", preventDefaults, false);
consoleDiv.addEventListener("drop", preventDefaults, false);
// The variables uid and gid are replaced by Github Actions.
var opts = {env:structure.env, cwd:"/home/user", uid: UID, gid: GID};
var opts = {env:structure.env, cwd:"/home/user", uid: 1000, gid: 1000};
while (true)
{
await cxLogAndRun(cx, structure.cmd, structure.args, opts);