Skip to content

Commit

Permalink
Update from base builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Neilpang committed Dec 10, 2023
1 parent c3badd6 commit c3afe81
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 24 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: vmactions
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
4 changes: 4 additions & 0 deletions .github/tpl/README.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

{{LATEST_TAG}}


1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ jobs:
dragonflybsd-${{ matrix.os }}.qcow2.xz
dragonflybsd-${{ matrix.os }}-id_rsa.pub
dragonflybsd-${{ matrix.os }}-host.id_rsa
dragonflybsd.iso
13 changes: 6 additions & 7 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ jobs:
build:
runs-on: ubuntu-22.04
env:
RELEASE: "6.4.0"
DEBUG: 1
VM_OS_NAME: dragonflybsd
NGROK_TOKEN : ${{ secrets.NGROK_TOKEN }}
SEC_VBOX : ${{ secrets.SEC_VBOX }}
steps:
- uses: actions/checkout@v4
- uses: vmactions/cf-tunnel@v0
- name: Creating web console
uses: vmactions/cf-tunnel@v0
id: tunnel
with:
protocol: http
port: 8000
- name: Run establish a ngrok tunnel
- name: Run vnc tunnel
id: test
uses: vmactions/[email protected]
with:
Expand All @@ -28,16 +27,16 @@ jobs:
- name: Sleep
run: |
for i in $(seq 1 10) ; do echo $i; sleep 1; done
latest=$(cat $(ls conf/dragonflybsd-*.conf | tail -1) | grep VM_RELEASE | cut -d = -f 2)
echo "please loging to ssh below, and run:"
echo "============================="
echo "bash build.sh conf/dragonflybsd-$RELEASE.conf"
echo "bash build.sh conf/dragonflybsd-$latest.conf"
echo "============================="
touch /tmp/keepalive
- uses: neilpang/debugger-action@master

# - run: |
# bash build.sh conf/dragonflybsd-$RELEASE.conf




Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Update Readme"
on:
workflow_dispatch:
push:
branches:
- 'main'
paths:
- '.github/tpl/*'
- '.github/data/*'
- '.github/workflows/readme.yml'

release:
types: [ published ]


jobs:
readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get latest release
id: get-latest-release
uses: InsonusK/[email protected]
with:
myToken: ${{ github.token }}
view_top: 1

- name: Using main branch
run: |
git switch main || (git fetch --all && git checkout -b main origin/main)
echo "LATEST_MAJOR=$(echo ${{ steps.get-latest-release.outputs.tag_name }} | cut -d . -f 1)" >> $GITHUB_ENV
echo "LATEST_TAG=${{ steps.get-latest-release.outputs.tag_name }}" >> $GITHUB_ENV
- name: Update the readme.md
uses: vmactions/[email protected]
with:
datafile: .github/data/datafile.ini
files: |
.github/tpl/README.tpl.md : README.md
- uses: EndBug/add-and-commit@v9
with:
message: "Update version to ${{ steps.get-latest-release.outputs.tag_name }}"
pull: '--rebase --autostash '
add: |
README.md
73 changes: 57 additions & 16 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,53 @@ if ! $vmsh clearVM $osname; then
echo "vm does not exists"
fi

$vmsh createVM $VM_ISO_LINK $osname $ostype $sshport


sleep 2

if [ "$VM_ISO_LINK" ]; then
$vmsh createVM $VM_ISO_LINK $osname $ostype $sshport

sleep 2

if [ -e "hooks/installOpts.sh" ]; then
echo "hooks/installOpts.sh"
cat "hooks/installOpts.sh"
. "hooks/installOpts.sh"
else
$vmsh processOpts $osname "$opts"

echo "sleep 60 seconds. just wait"
sleep 60

if $vmsh isRunning $osname; then
if ! $vmsh shutdownVM $osname; then
echo "shutdown error"
fi
if ! $vmsh destroyVM $osname; then
echo "destroyVM error"
fi
fi
fi

$vmsh processOpts $osname "$opts"
while $vmsh isRunning $osname; do
sleep 5
done

elif [ "$VM_VHD_LINK" ]; then
if [ ! -e "$osname.qcow2.xz" ]; then
$vmsh download "$VM_VHD_LINK" $osname.qcow2.xz
fi

if [ ! -e "$osname.qcow2" ]; then
xz -d -T 0 --verbose "$osname.qcow2.xz"
fi

$vmsh shutdownVM $osname
$vmsh destroyVM $osname
$vmsh createVMFromVHD $osname $ostype $sshport

while $vmsh isRunning $osname; do
sleep 5
done

else
echo "no VM_ISO_LINK or VM_VHD_LINK, can not build."
exit 1
fi

$vmsh startVM $osname

Expand All @@ -97,14 +127,21 @@ sleep 2

###############################################



waitForText "$VM_LOGIN_TAG"
if [ -e "hooks/waitForLoginTag.sh" ]; then
echo "hooks/waitForLoginTag.sh"
cat "hooks/waitForLoginTag.sh"
. "hooks/waitForLoginTag.sh"
else
waitForText "$VM_LOGIN_TAG"
fi

sleep 3

inputKeys "string root ; enter ; enter"

inputKeys "string root; enter; sleep 1;"
if [ "$VM_ROOT_PASSWORD" ]; then
inputKeys "string $VM_ROOT_PASSWORD ; enter"
fi
inputKeys "enter"
sleep 2


Expand Down Expand Up @@ -242,8 +279,12 @@ else
$vmsh addSSHAuthorizedKeys $osname-$VM_RELEASE-id_rsa.pub
$vmsh startVM $osname
$vmsh waitForVMReady $osname
ssh $osname sh <<<"$VM_INSTALL_CMD $VM_RSYNC_PKG"
ssh $osname sh <<<"$VM_INSTALL_CMD $VM_SSHFS_PKG"
if [ "$VM_RSYNC_PKG" ]; then
ssh $osname sh <<<"$VM_INSTALL_CMD $VM_RSYNC_PKG"
fi
if [ "$VM_SSHFS_PKG" ]; then
ssh $osname sh <<<"$VM_INSTALL_CMD $VM_SSHFS_PKG"
fi
fi


0 comments on commit c3afe81

Please sign in to comment.