63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
name: Build Ubuntu Noble Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'packer/**'
|
|
- '.gitea/workflows/packer-build.yaml'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
packer:
|
|
runs-on: ubuntu-latest
|
|
name: Build QEMU Image
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache Dependencies
|
|
id: cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.config/packer/plugins/
|
|
/opt/hostedtoolcache/packer_linux/
|
|
key: ${{ runner.os }}-20260307-${{ hashFiles('~/.config/packer/plugins/**','/opt/hostedtoolcache/packer_linux/**') }}
|
|
restore-keys: ${{ runner.os }}-20260307-
|
|
|
|
- name: Packer install plugins
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
packer plugins install github.com/hashicorp/qemu
|
|
|
|
- name: Install QEMU and Dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y qemu-system-x86 qemu-utils xorriso
|
|
[ -e /dev/kvm ] && sudo chmod 666 /dev/kvm || echo "KVM not available Use TCG"
|
|
|
|
- name: Build Image
|
|
run: |
|
|
cd packer
|
|
packer init .
|
|
packer validate .
|
|
packer build .
|
|
env:
|
|
PACKER_LOG: 1
|
|
|
|
- name: Upload Artifact
|
|
run: |
|
|
NAME=ubuntu-noble-$(date +%Y-%m-%d-%H%M)
|
|
curl -f -sS -u "${{ secrets.NEXUS_USERNAME }}:${{ secrets.NEXUS_PASSWORD }}" \
|
|
-X POST \
|
|
"${{ vars.NEXUS_URL }}/service/rest/v1/components?repository=releases" \
|
|
-F raw.directory=/releases/cloud/ \
|
|
-F raw.asset1=@packer/output/ubuntu-noble.qcow2 \
|
|
-F raw.asset1.filename=$NAME.qcow2 \
|
|
-F raw.asset2=@packer/output/ubuntu-noble.qcow2.sha256.checksum \
|
|
-F raw.asset2.filename=$NAME.qcow2.sha256.checksum
|