Switch to using Github Actions

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.
This commit is contained in:
Antony Messerli 2020-12-03 04:31:03 -06:00
parent 8dc689727a
commit 3830da6bb2
9 changed files with 273 additions and 204 deletions

View file

@ -11,8 +11,8 @@ DOCKER_FILE="Dockerfile-build.production"
# Set boot domain
if [[ "${TYPE}" == "dev" ]]; then
BOOT_DOMAIN="s3.amazonaws.com/${DEV_URL}/${TRAVIS_COMMIT}"
BOOT_VERSION="${TRAVIS_COMMIT}"
BOOT_DOMAIN="s3.amazonaws.com/${DEV_URL}/${GITHUB_SHA}"
BOOT_VERSION="${GITHUB_SHA}"
elif [[ "${TYPE}" == "pr" ]]; then
BOOT_DOMAIN="test.com"
BOOT_VERSION="test"
@ -33,7 +33,7 @@ sed -i \
# Build release
docker build -t localbuild -f ${DOCKER_FILE} .
docker run --rm -it -v $(pwd):/buildout localbuild
docker run --rm -i -v $(pwd):/buildout localbuild
# Generate folder outputs
mkdir -p s3out
@ -68,7 +68,7 @@ if [[ "${TYPE}" == "release" ]] || [[ "${TYPE}" == "rc" ]]; then
-e "/^boot_domain/c\boot_domain: ${STAGING_URL}/rc" \
user_overrides.yml
docker build -t localbuild -f ${DOCKER_FILE} .
docker run --rm -it -v $(pwd):/buildout localbuild
docker run --rm -i -v $(pwd):/buildout localbuild
fi
mkdir -p s3out-latest
cp -r buildout/* s3out-latest/

View file

@ -4,39 +4,38 @@ set -e
TYPE=$1
if [ "${TYPE}" == "dev-push" ]; then
BOOT_URL="https://s3.amazonaws.com/${BUCKET_DEV}/${TRAVIS_COMMIT}/index.html"
BOOT_URL="https://s3.amazonaws.com/dev.boot.netboot.xyz/${GITHUB_SHA}/index.html"
elif [ "${TYPE}" == "rc-push" ]; then
BOOT_URL="https://staging.boot.netboot.xyz/$(cat version.txt)-RC/index.html"
elif [ "${TYPE}" == "live-push" ]; then
BOOT_URL="https://boot.netboot.xyz/$(cat version.txt)/index.html"
fi
# send status to discord
if [ "${TYPE}" == "failure" ]; then
curl -X POST -H "Content-Type: application/json" --data \
'{
"avatar_url": "https://unavatar.now.sh/twitter/travisci",
"avatar_url": "https://unavatar.now.sh/twitter/github",
"embeds": [
{
"color": 16711680,
"description": "__**Failed to Build**__ \n**Build:** '${TRAVIS_BUILD_WEB_URL}'\n**Status:** Failure\n**Change:** https://github.com/netbootxyz/netboot.xyz/commit/'${TRAVIS_COMMIT}'\n"
"description": "__**Failed to Build**__ \n**Build:** 'https://github.com/netbootxyz/netboot.xyz/actions/runs/${GITHUB_RUN_ID}'\n**Status:** Failure\n**Change:** https://github.com/netbootxyz/netboot.xyz/commit/'${GITHUB_SHA}'\n"
}
],
"username": "Travis CI"
"username": "Github"
}' \
${DISCORD_HOOK_URL}
else
curl -X POST -H "Content-Type: application/json" --data \
'{
"avatar_url": "https://unavatar.now.sh/twitter/travisci",
"avatar_url": "https://unavatar.now.sh/twitter/github",
"embeds": [
{
"color": 1681177,
"description": "__**Boot Menu Published**__ \n**Files:** '${BOOT_URL}' \n**Build:** '${TRAVIS_BUILD_WEB_URL}'\n**Change:** https://github.com/netbootxyz/netboot.xyz/commit/'${TRAVIS_COMMIT}'\n"
"description": "__**Boot Menu Published**__ \n**Files:** '${BOOT_URL}' \n**Build:** 'https://github.com/netbootxyz/netboot.xyz/actions/runs/${GITHUB_RUN_ID}'\n**Change:** https://github.com/netbootxyz/netboot.xyz/commit/'${GITHUB_SHA}'\n"
}
],
"username": "Travis CI"
"username": "Github"
}' \
${DISCORD_HOOK_URL}
fi

View file

@ -4,5 +4,5 @@ set -e
# retrieve certs
git clone https://$GIT_USER:$GIT_AUTH@$GIT_URL certs
cp certs/certs.tar.enc .
openssl aes-256-cbc -K $encrypted_9ca5918f08ba_key -iv $encrypted_9ca5918f08ba_iv -in certs.tar.enc -out certs.tar -d
openssl aes-256-cbc -pass pass:$CERTS_KEY -d -salt -pbkdf2 -a -in certs.tar.enc -out certs.tar
tar xf certs.tar -C certs