mirror of
https://github.com/netbootxyz/netboot.xyz.git
synced 2026-01-23 02:34:26 +00:00
With the recent changes to Travis CI, it seemed like a good time to begin porting netboot.xyz CI over to Github Actions to keep everything in on place. These are the changes for the main netboot.xyz repo.
75 lines
2.1 KiB
Bash
Executable file
75 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
TYPE=$1
|
|
HARD_RELEASE="2.x"
|
|
HARD_RC="2.x-RC"
|
|
DEV_URL="dev.boot.netboot.xyz"
|
|
STAGING_URL="staging.boot.netboot.xyz"
|
|
PROD_URL="boot.netboot.xyz"
|
|
DOCKER_FILE="Dockerfile-build.production"
|
|
|
|
# Set boot domain
|
|
if [[ "${TYPE}" == "dev" ]]; then
|
|
BOOT_DOMAIN="s3.amazonaws.com/${DEV_URL}/${GITHUB_SHA}"
|
|
BOOT_VERSION="${GITHUB_SHA}"
|
|
elif [[ "${TYPE}" == "pr" ]]; then
|
|
BOOT_DOMAIN="test.com"
|
|
BOOT_VERSION="test"
|
|
DOCKER_FILE="Dockerfile-build"
|
|
elif [[ "${TYPE}" == "rc" ]]; then
|
|
BOOT_VERSION=$(cat version.txt)-RC
|
|
BOOT_DOMAIN="${STAGING_URL}/${BOOT_VERSION}"
|
|
elif [[ "${TYPE}" == "release" ]]; then
|
|
BOOT_VERSION=$(cat version.txt)
|
|
BOOT_DOMAIN="${PROD_URL}/${BOOT_VERSION}"
|
|
fi
|
|
sed -i \
|
|
"/^#boot_version/c\boot_version: \"${BOOT_VERSION}\"" \
|
|
user_overrides.yml
|
|
sed -i \
|
|
"/^#boot_domain/c\boot_domain: ${BOOT_DOMAIN}" \
|
|
user_overrides.yml
|
|
|
|
# Build release
|
|
docker build -t localbuild -f ${DOCKER_FILE} .
|
|
docker run --rm -i -v $(pwd):/buildout localbuild
|
|
|
|
# Generate folder outputs
|
|
mkdir -p s3out
|
|
mkdir -p s3outver
|
|
cp -r buildout/* s3out/
|
|
cp buildout/version.ipxe s3outver/
|
|
mkdir -p githubout
|
|
mv buildout/ipxe/* githubout/
|
|
cd buildout
|
|
rm -Rf ipxe
|
|
tar -czf menus.tar.gz *
|
|
mv menus.tar.gz ../githubout
|
|
cd ..
|
|
if [[ "${TYPE}" == "dev" ]]; then
|
|
cp githubout/menus.tar.gz s3out/
|
|
fi
|
|
|
|
# Latest style endpoints for RC and Live
|
|
if [[ "${TYPE}" == "release" ]] || [[ "${TYPE}" == "rc" ]]; then
|
|
rm -Rf buildout/
|
|
if [[ "${TYPE}" == "release" ]]; then
|
|
sed -i \
|
|
-e "/^boot_version/c\boot_version: \"${HARD_RELEASE}\"" \
|
|
-e "/^boot_domain/c\boot_domain: ${PROD_URL}" \
|
|
user_overrides.yml
|
|
docker build -t localbuild -f ${DOCKER_FILE} .
|
|
docker run --rm -it -v $(pwd):/buildout localbuild
|
|
fi
|
|
if [[ "${TYPE}" == "rc" ]]; then
|
|
sed -i \
|
|
-e "/^boot_version/c\boot_version: \"${HARD_RC}\"" \
|
|
-e "/^boot_domain/c\boot_domain: ${STAGING_URL}/rc" \
|
|
user_overrides.yml
|
|
docker build -t localbuild -f ${DOCKER_FILE} .
|
|
docker run --rm -i -v $(pwd):/buildout localbuild
|
|
fi
|
|
mkdir -p s3out-latest
|
|
cp -r buildout/* s3out-latest/
|
|
fi
|