-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: build & upload TKL v16 with GitHub Actions (#2)
- Loading branch information
Showing
29 changed files
with
965 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,45 @@ | ||
name: Packer Build | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
name: Build boxes | ||
on: [push, pull_request, workflow_dispatch] | ||
jobs: | ||
packer-build: | ||
runs-on: macos-10.15 | ||
run-packer: | ||
runs-on: macos-12 | ||
env: | ||
MAKE_VARS: --dry-run | ||
PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: [tkl16] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Packer Build | ||
run: packer build -only=virtualbox-iso -var-file=tkl150-core.json -var "version=2021.3.23" -except=publish,manifest,shell-local tkl.json | ||
- name: Prepare environment | ||
run: | | ||
brew install make | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Set to not dry-run | ||
if: github.event_name != 'push' | ||
run: | | ||
echo "MAKE_VARS=" >> $GITHUB_ENV | ||
- name: Packer boot | ||
run: | | ||
gmake ${{ env.MAKE_VARS }} boot-${{ matrix.version }} | ||
- name: Packer install | ||
run: | | ||
gmake ${{ env.MAKE_VARS }} install-${{ matrix.version }} | ||
- name: Packer update | ||
run: | | ||
gmake ${{ env.MAKE_VARS }} update-${{ matrix.version }} | ||
# - name: Packer provision | ||
# run: | | ||
# gmake ${{ env.MAKE_VARS }} provision-${{ matrix.version }} | ||
- name: Packer export | ||
run: | | ||
gmake ${{ env.MAKE_VARS }} export-${{ matrix.version }} | ||
- name: Packer upload | ||
if: github.ref_name == 'main' | ||
env: | ||
PKR_VAR_no_release: false | ||
run: | | ||
cd upload | ||
gmake ${{ env.MAKE_VARS }} ${{ matrix.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Release boxes | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
required: true | ||
description: Version of Vagrant box to release | ||
|
||
jobs: | ||
run-packer-release: | ||
runs-on: macos-12 | ||
env: | ||
PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: [tkl16] | ||
steps: | ||
- name: Prepare environment | ||
run: | | ||
brew install make | ||
INPUT=${{ inputs.version }} | ||
[ -n "$INPUT" ] && echo "PKR_VAR_version=$INPUT" >> $GITHUB_ENV \ | ||
|| echo "Workflow input not given" | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Download Vagrant box file | ||
run: | | ||
BOX_FILE=box/virtualbox/${{ matrix.version }}.box | ||
BOX_URL=https://vagrantcloud.com/techneg/boxes/ | ||
BOX_URL+=test-${{ matrix.version }}x64-nocm/versions/ | ||
BOX_URL+=${{ inputs.version }}/providers/virtualbox.box | ||
mkdir -p "${BOX_FILE%/*}" | ||
case ${{ github.event_name }} in | ||
workflow_dispatch) | ||
wget --no-verbose -O "$BOX_FILE" "$BOX_URL" | ||
;; | ||
esac | ||
- name: Packer release | ||
env: | ||
PKR_VAR_prefix: ~ | ||
run: | | ||
cd upload && gmake main.cat.pkr.hcl | ||
case ${{ github.event_name }} in | ||
workflow_dispatch) | ||
packer build -timestamp-ui -force -only \*.${{ matrix.version }} . | ||
;; | ||
*) | ||
packer inspect . | ||
packer validate -only \*.${{ matrix.version }} . | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
packer_cache/ | ||
output-* | ||
*.box | ||
*.tar.gz | ||
iso | ||
crash.log | ||
tmp | ||
/box/ | ||
/vms/ | ||
|
||
/iso | ||
|
||
.vagrant/ | ||
*.swp | ||
Makefile.local | ||
box/ | ||
builds/ | ||
output-*/ | ||
packer_cache/ | ||
|
||
*.snapshot | ||
*.cat.pkr.hcl | ||
|
||
.DS_Store | ||
.tmpatlas/ | ||
.kitchen/ | ||
.kitchen.local.yml | ||
serial.box |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,4 @@ | ||
BOX_VERSION ?= $(shell cat VERSION) | ||
BOX_SUFFIX := -$(BOX_VERSION).box | ||
BUILDER_TYPES ?= vmware virtualbox parallels | ||
TEMPLATE_FILENAMES := $(filter-out debian.json,$(wildcard *.json)) | ||
BOX_NAMES := $(basename $(TEMPLATE_FILENAMES)) | ||
BOX_FILENAMES := $(TEMPLATE_FILENAMES:.json=$(BOX_SUFFIX)) | ||
VMWARE_BOX_DIR ?= box/vmware | ||
VMWARE_TEMPLATE_FILENAMES = $(TEMPLATE_FILENAMES) | ||
VMWARE_BOX_FILENAMES := $(VMWARE_TEMPLATE_FILENAMES:.json=$(BOX_SUFFIX)) | ||
VMWARE_BOX_FILES := $(foreach box_filename, $(VMWARE_BOX_FILENAMES), $(VMWARE_BOX_DIR)/$(box_filename)) | ||
VIRTUALBOX_BOX_DIR ?= box/virtualbox | ||
VIRTUALBOX_TEMPLATE_FILENAMES = $(TEMPLATE_FILENAMES) | ||
VIRTUALBOX_BOX_FILENAMES := $(VIRTUALBOX_TEMPLATE_FILENAMES:.json=$(BOX_SUFFIX)) | ||
VIRTUALBOX_BOX_FILES := $(foreach box_filename, $(VIRTUALBOX_BOX_FILENAMES), $(VIRTUALBOX_BOX_DIR)/$(box_filename)) | ||
PARALLELS_BOX_DIR ?= box/parallels | ||
PARALLELS_TEMPLATE_FILENAMES = $(TEMPLATE_FILENAMES) | ||
PARALLELS_BOX_FILENAMES := $(PARALLELS_TEMPLATE_FILENAMES:.json=$(BOX_SUFFIX)) | ||
PARALLELS_BOX_FILES := $(foreach box_filename, $(PARALLELS_BOX_FILENAMES), $(PARALLELS_BOX_DIR)/$(box_filename)) | ||
BOX_FILES := $(VMWARE_BOX_FILES) $(VIRTUALBOX_BOX_FILES) $(PARALLELS_BOX_FILES) | ||
ISO_FILES := $(shell sed -nE 's/^.*iso_name.*:\s*"([^"]+\.iso)".*$$/iso\/\1/p' $(TEMPLATE_FILENAMES)) | ||
|
||
box/vmware/%$(BOX_SUFFIX) box/virtualbox/%$(BOX_SUFFIX) box/parallels/%$(BOX_SUFFIX): %.json | ||
bin/box build $< | ||
|
||
.PHONY: all clean isos assure deliver assure_atlas assure_atlas_vmware assure_atlas_virtualbox assure_atlas_parallels | ||
|
||
all: isos build assure deliver | ||
|
||
iso/%.iso: | ||
mkdir -p iso | ||
@cd iso && ( \ | ||
CURRENT_URL="http://cdimage.debian.org/debian-cd/$(shell echo "$@" | cut -d- -f2,3 --output-delimiter=/)/jigdo-dvd/$(notdir $(basename $@)).jigdo" ; \ | ||
ARCHIVE_URL="http://cdimage.debian.org/mirror/cdimage/archive/$(shell echo "$@" | cut -d- -f2,3 --output-delimiter=/)/jigdo-dvd/$(notdir $(basename $@)).jigdo" ; \ | ||
\ | ||
if curl -sfI "$$CURRENT_URL" >/dev/null ; then \ | ||
URL="$$CURRENT_URL" ; \ | ||
else \ | ||
URL="$$ARCHIVE_URL" ; \ | ||
fi ; \ | ||
jigdo-lite --noask "$$URL" ; \ | ||
) | ||
|
||
isos: $(ISO_FILES) | ||
|
||
build: $(BOX_FILES) | ||
|
||
assure: assure_vmware assure_virtualbox assure_parallels | ||
|
||
assure_vmware: $(VMWARE_BOX_FILES) | ||
@for vmware_box_file in $(VMWARE_BOX_FILES) ; do \ | ||
echo Checking $$vmware_box_file ; \ | ||
bin/box test $$vmware_box_file vmware ; \ | ||
done | ||
|
||
assure_virtualbox: $(VIRTUALBOX_BOX_FILES) | ||
@for virtualbox_box_file in $(VIRTUALBOX_BOX_FILES) ; do \ | ||
echo Checking $$virtualbox_box_file ; \ | ||
bin/box test $$virtualbox_box_file virtualbox ; \ | ||
done | ||
|
||
assure_parallels: $(PARALLELS_BOX_FILES) | ||
@for parallels_box_file in $(PARALLELS_BOX_FILES) ; do \ | ||
echo Checking $$parallels_box_file ; \ | ||
bin/box test $$parallels_box_file parallels ; \ | ||
done | ||
|
||
assure_atlas: assure_atlas_vmware assure_atlas_virtualbox assure_atlas_parallels | ||
|
||
assure_atlas_vmware: | ||
@for box_name in $(BOX_NAMES) ; do \ | ||
echo Checking $$box_name ; \ | ||
bin/test-vagrantcloud-box box-cutter/$$box_name vmware ; \ | ||
bin/test-vagrantcloud-box boxcutter/$$box_name vmware ; \ | ||
done | ||
|
||
assure_atlas_virtualbox: | ||
@for box_name in $(BOX_NAMES) ; do \ | ||
echo Checking $$box_name ; \ | ||
bin/test-vagrantcloud-box box-cutter/$$box_name virtualbox ; \ | ||
bin/test-vagrantcloud-box boxcutter/$$box_name virtualbox ; \ | ||
done | ||
|
||
assure_atlas_parallels: | ||
@for box_name in $(BOX_NAME) ; do \ | ||
echo Checking $$box_name ; \ | ||
bin/test-vagrantcloud-box box-cutter/$$box_name parallels ; \ | ||
bin/test-vagrantcloud-box boxcutter/$$box_name parallels ; \ | ||
done | ||
|
||
deliver: | ||
@for box_name in $(BOX_NAMES) ; do \ | ||
echo Uploading $$box_name to Atlas ; \ | ||
bin/register_atlas.sh $$box_name $(BOX_SUFFIX) $(BOX_VERSION) ; \ | ||
done | ||
|
||
clean: | ||
@for builder in $(BUILDER_TYPES) ; do \ | ||
echo Deleting output-*-$$builder-iso ; \ | ||
echo rm -rf output-*-$$builder-iso ; \ | ||
done | ||
@for builder in $(BUILDER_TYPES) ; do \ | ||
if test -d box/$$builder ; then \ | ||
echo Deleting box/$$builder/*.box ; \ | ||
find box/$$builder -maxdepth 1 -type f -name "*.box" ! -name .gitignore -exec rm '{}' \; ; \ | ||
fi ; \ | ||
done | ||
@if [ -L iso ] ; then \ | ||
echo "NOT deleting iso (it is a symlink)" ; \ | ||
else \ | ||
echo rm -rf iso ; \ | ||
rm -rf iso ; \ | ||
fi ; | ||
#subdirs = boot install guestadd update provision export | ||
subdirs = boot install kernel update export | ||
|
||
include $(addsuffix /Makefile,$(subdirs)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
if [ "${DEBUG:-false}" = "true" ]; then | ||
set -x # Run the entire script in debug mode | ||
fi | ||
|
||
serial="serial.box" | ||
if [ ! -e "$serial" ] ; then | ||
cur=1 | ||
else | ||
read cur <$serial | ||
fi | ||
|
||
next=$((cur + 1)) | ||
echo $next >$serial | ||
|
||
cur=${GITHUB_RUN_NUMBER:-$cur} | ||
|
||
VERSION="$(date +%Y.%-m).$cur" | ||
|
||
echo $VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
sp := $(subst ,, ) | ||
_walk = $(if $1,$(wildcard /$(subst $(sp),/,$1)/$2) $(call _walk,$(wordlist 2,$(words $1),x $1),$2)) | ||
_find = $(firstword $(call _walk,$(strip $(subst /, ,$1)),$2)) | ||
_ROOT ?= $(patsubst %/root.mk,%,$(call _find,$(CURDIR),root.mk)) | ||
_ROOT := ${_ROOT} | ||
|
||
include $(_ROOT)/root.mk | ||
include $(_ROOT)/pre.mk | ||
|
||
srcs := main.cat.pkr.hcl | ||
#extra_srcs != find $(_ROOT)/floppy -type f | ||
artifact_ext = $(vdiext) | ||
|
||
$(_module_name)_output := $(_ROOT)/vms/virtualbox | ||
|
||
include $(_ROOT)/post.mk |
Oops, something went wrong.