Simplify workflow configuration
This commit is contained in:
parent
4f490dc153
commit
8e8d77bc6e
22
.github/workflows/deploy.yml
vendored
22
.github/workflows/deploy.yml
vendored
@ -19,12 +19,6 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
default: '600M'
|
default: '600M'
|
||||||
|
|
||||||
LOGIN_UGID:
|
|
||||||
type: string
|
|
||||||
description: 'UID:GID of the starting process'
|
|
||||||
required: true
|
|
||||||
default: "1000:1000"
|
|
||||||
|
|
||||||
DEPLOY_TO_GITHUB_PAGES:
|
DEPLOY_TO_GITHUB_PAGES:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: 'Deploy to Github pages'
|
description: 'Deploy to Github pages'
|
||||||
@ -37,12 +31,6 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
GITHUB_RELEASE_TAG:
|
|
||||||
type: string
|
|
||||||
description: 'Tag for the GitHub release'
|
|
||||||
required: true
|
|
||||||
default: "ext2_image"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@ -79,11 +67,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "IMAGE_NAME=$(basename ${{ github.event.inputs.DOCKERFILE_PATH }})_$(date +%Y%m%d)_${{ github.run_id }}.ext2" >> $GITHUB_ENV
|
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
|
||||||
|
|
||||||
@ -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 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"
|
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:
|
# 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.
|
# 2. Replaces all occurrences of IMAGE_URL with the URL to the image.
|
||||||
# 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#"${{ 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#IMAGE_URL#"${{ env.IMAGE_NAME }}"#g' ${{ env.DEPLOY_DIR }}index.html
|
||||||
sudo sed -i 's#DEVICE_TYPE#"split"#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
|
uses: softprops/action-gh-release@v0.1.15
|
||||||
with:
|
with:
|
||||||
target_commitish: ${{ github.sha }} # Last commit on the GITHUB_REF branch or tag
|
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).
|
fail_on_unmatched_files: 'true' # Fail in case of no matches with the file(s) glob(s).
|
||||||
files: | # Assets to upload as release.
|
files: | # Assets to upload as release.
|
||||||
${{ env.IMAGE_NAME }}
|
${{ env.IMAGE_NAME }}
|
||||||
|
@ -43,7 +43,6 @@ From a local `git clone`
|
|||||||
- You can also build your own by selecting the "Upload GitHub release" workflow option.
|
- You can also build your own by selecting the "Upload GitHub release" workflow option.
|
||||||
- Place the image in the repository root folder.
|
- Place the image in the repository root folder.
|
||||||
- Edit `index.html`
|
- Edit `index.html`
|
||||||
- Replace the `UID`/`GID` variables with `1000`
|
|
||||||
- Replace `DEVICE_TYPE` with `"bytes"`
|
- Replace `DEVICE_TYPE` with `"bytes"`
|
||||||
- Replace `IMAGE_URL` with the name of the Ext2 image. For example `"debian_mini_20230519_5022088024.ext2"`
|
- Replace `IMAGE_URL` with the name of the Ext2 image. For example `"debian_mini_20230519_5022088024.ext2"`
|
||||||
- Start a local HTTP server
|
- Start a local HTTP server
|
||||||
|
@ -286,8 +286,7 @@ __ __ _ __ ____ __
|
|||||||
consoleDiv.addEventListener("dragleave", preventDefaults, false);
|
consoleDiv.addEventListener("dragleave", preventDefaults, false);
|
||||||
consoleDiv.addEventListener("drop", 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: 1000, gid: 1000};
|
||||||
var opts = {env:structure.env, cwd:"/home/user", uid: UID, gid: GID};
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
await cxLogAndRun(cx, structure.cmd, structure.args, opts);
|
await cxLogAndRun(cx, structure.cmd, structure.args, opts);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user