Nightly Build #2057
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
name: Nightly Build | |
on: | |
schedule: | |
- cron: 0 12 * * * | |
repository_dispatch: | |
workflow_dispatch: | |
inputs: | |
force-git: | |
description: 'Force publish of git artifacts' | |
default: 'No' | |
type: choice | |
options: | |
- 'No' | |
- 'Yes' | |
jobs: | |
workflowvars: | |
name: Setup Workflow Vars | |
runs-on: ubuntu-latest | |
outputs: | |
dockermissing: ${{ steps.check_docker_credentials.outputs.missingsecrets }} | |
rollbarmissing: ${{ steps.check_rollbar_credentials.outputs.missingsecrets }} | |
servermissing: ${{ steps.check_server_credentials.outputs.missingsecrets }} | |
branch: ${{ steps.build_env.outputs.branch }} | |
revision: ${{ steps.build_env.outputs.revision }} | |
ghcrrepo: ${{ steps.build_env.outputs.ghcrrepo }} | |
nb_revision: ${{ steps.nb_env.outputs.nb_revision }} | |
shouldbuild: ${{ steps.nb_env.outputs.shouldbuild }} | |
ispublished: ${{ steps.check_published.outputs.ispublished }} | |
dryrun: ${{ steps.check_pbnb.outputs.dryrun }} | |
steps: | |
- name: Checkout Nightly Build Repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
path: nb | |
- name: Checkout PhantomBot Repository | |
uses: actions/checkout@v4 | |
with: | |
repository: PhantomBot/PhantomBot | |
persist-credentials: false | |
path: pb | |
- name: Get Revision Variables | |
id: build_env | |
env: | |
REPONAME: ${{ github.repository }} | |
run: | | |
cd ${GITHUB_WORKSPACE}/pb | |
DATE=$(date +%m%d%Y) | |
BRANCH=NB-${DATE} | |
echo ${BRANCH} | |
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT | |
echo $(git rev-parse --short HEAD) | |
echo "revision=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo ${REPONAME} | awk '{print tolower($0)}' | |
echo "ghcrrepo=$(echo ${REPONAME} | awk '{print tolower($0)}')" >> $GITHUB_OUTPUT | |
- name: Get Nightly Variables | |
id: nb_env | |
env: | |
REVISION: ${{ steps.build_env.outputs.revision }} | |
FORCE_GIT: ${{ github.event.inputs.force-git }} | |
run: | | |
cd ${GITHUB_WORKSPACE}/nb | |
NB_REVISION=$(cat last_repo_version) | |
echo ${NB_REVISION} | |
echo "nb_revision=${NB_REVISION}" >> $GITHUB_OUTPUT | |
if [ "${REVISION}" == "${NB_REVISION}" ] && [ "${FORCE_GIT}" != "Yes" ]; then | |
ISOLD=find ./historical -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2- | tail -n 1 | awk '{s=gensub(/.+-([0-9]{2})([0-9]{2})([0-9]{4})\.([0-9]{2})([0-9]{2})([0-9]{2})\.zip/, "\\3 \\1 \\2 \\4 \\5 \\6", ""); t=mktime(s); d=systime() - t; if (d >= 1728000){ print("true"); } else { print("false"); }}' 2>/dev/null | |
if [ "${ISOLD}" == "true" ]; then | |
echo "Nightly build is old, building anyway..." | |
echo "shouldbuild=yes" >> $GITHUB_OUTPUT | |
else | |
echo "Nightly build is recent" | |
echo "shouldbuild=no" >> $GITHUB_OUTPUT | |
fi | |
else | |
echo "New revision, building..." | |
echo "shouldbuild=yes" >> $GITHUB_OUTPUT | |
fi | |
- name: Check Docker Credentials | |
id: check_docker_credentials | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_CLITOKEN: ${{ secrets.DOCKER_CLITOKEN }} | |
DOCKER_REPO: ${{ secrets.DOCKER_REPO }} | |
run: | | |
if [ "${DOCKER_USER}" == "" ]; then | |
echo "Missing User" | |
echo "missingsecrets=yes" >> $GITHUB_OUTPUT | |
elif [ "${DOCKER_CLITOKEN}" == "" ]; then | |
echo "Missing Cli Token" | |
echo "missingsecrets=yes" >> $GITHUB_OUTPUT | |
elif [ "${DOCKER_REPO}" == "" ]; then | |
echo "Missing Repo" | |
echo "missingsecrets=yes" >> $GITHUB_OUTPUT | |
else | |
echo "All secrets present" | |
echo "missingsecrets=no" >> $GITHUB_OUTPUT | |
fi | |
- name: Check Rollbar Credentials | |
id: check_rollbar_credentials | |
env: | |
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_WRITE_TOKEN }} | |
run: | | |
if [ "${ROLLBAR_ACCESS_TOKEN}" == "" ]; then | |
echo "Missing Rollbar Access Token" | |
echo "missingsecrets=yes" >> $GITHUB_OUTPUT | |
else | |
echo "All secrets present" | |
echo "missingsecrets=no" >> $GITHUB_OUTPUT | |
fi | |
- name: Check Rollbar Passthrough Server Credentials | |
id: check_server_credentials | |
env: | |
ACCESS_TOKEN: ${{ secrets.SERVER_TOKEN }} | |
URL: ${{ secrets.SERVER_URL }} | |
run: | | |
if [ "${ACCESS_TOKEN}" == "" ]; then | |
echo "Missing Access Token" | |
echo "missingsecrets=yes" >> $GITHUB_OUTPUT | |
elif [ "${URL}" == "" ]; then | |
echo "Missing URL" | |
echo "missingsecrets=yes" >> $GITHUB_OUTPUT | |
else | |
echo "All secrets present" | |
echo "missingsecrets=no" >> $GITHUB_OUTPUT | |
fi | |
- name: Check Docker Already Published | |
id: check_published | |
env: | |
MISSING: ${{ steps.check_docker_credentials.outputs.missingsecrets }} | |
DOCKER_REPO: ${{ secrets.DOCKER_REPO }} | |
REVISION: ${{ steps.build_env.outputs.revision }} | |
run: | | |
if [ "${MISSING}" == "no" ]; then | |
HTTPCODE=$(curl -s -I "https://registry.hub.docker.com/v2/repositories/${DOCKER_REPO}/tags/${REVISION}/" | head -n 1 | cut -d$' ' -f2) | |
echo ${HTTPCODE} | |
if [ "${HTTPCODE}" == "200" ]; then | |
echo "Already Published" | |
echo "ispublished=yes" >> $GITHUB_OUTPUT | |
else | |
echo "Not Published" | |
echo "ispublished=no" >> $GITHUB_OUTPUT | |
fi | |
else | |
echo "No DockerHub" | |
echo "ispublished=no" >> $GITHUB_OUTPUT | |
fi | |
- name: Check is PB NB Repo | |
id: check_pbnb | |
env: | |
REPO: ${{ github.repository }} | |
run: | | |
if [ "${REPO}" == "PhantomBot/nightly-build" ]; then | |
echo "Do Nightly Build Publish" | |
echo "dryrun=no" >> $GITHUB_OUTPUT | |
else | |
echo "Do Dry Run" | |
echo "dryrun=yes" >> $GITHUB_OUTPUT | |
fi | |
buildtest: | |
name: Test Build on ubuntu-latest | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout PhantomBot Repository | |
uses: actions/checkout@v4 | |
with: | |
repository: PhantomBot/PhantomBot | |
persist-credentials: false | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Set up Ant | |
run: sudo apt-get install ant | |
- name: Build with Ant | |
run: ant -noinput -buildfile build.xml test | |
dockertest: | |
name: Docker test on ubuntu-latest | |
runs-on: ubuntu-latest | |
needs: buildtest | |
timeout-minutes: 5 | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
repository: PhantomBot/PhantomBot | |
persist-credentials: false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
driver-opts: network=host | |
- name: Build Docker | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
PROJECT_VERSION=0.0.0 | |
ANT_ARGS=-Dbuildtype=test -Dversion=0.0.0 | |
tags: localhost:5000/tester/phantombot:test | |
- name: Test with Docker | |
run: docker run --rm --name phantombot localhost:5000/tester/phantombot:test launch-docker.sh --version | |
build: | |
name: Build and push on ubuntu-latest | |
runs-on: ubuntu-latest | |
needs: [buildtest, dockertest, workflowvars] | |
if: ${{ contains(needs.workflowvars.outputs.shouldbuild, 'yes') && contains(needs.workflowvars.outputs.dryrun, 'no') }} | |
steps: | |
- name: Checkout Nightly Build Repository | |
uses: actions/checkout@v4 | |
with: | |
path: nb | |
- name: Checkout PhantomBot Repository | |
uses: actions/checkout@v4 | |
with: | |
repository: PhantomBot/PhantomBot | |
path: pb | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Set up Ant | |
run: sudo apt-get install ant | |
- name: Notify Rollbar of Deploy Start | |
if: contains(needs.workflowvars.outputs.rollbarmissing, 'no') | |
id: rollbar_deploy | |
uses: rollbar/[email protected] | |
with: | |
environment: "nightly_build" | |
version: ${{ needs.workflowvars.outputs.revision }} | |
status: "started" | |
env: | |
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_WRITE_TOKEN }} | |
ROLLBAR_USERNAME: ${{ github.actor }} | |
- name: Prep Ant script | |
env: | |
BRANCH: ${{ needs.workflowvars.outputs.branch }} | |
REVISION: ${{ needs.workflowvars.outputs.revision }} | |
run: | | |
cd ${GITHUB_WORKSPACE}/pb | |
sed -i -r 's/revision="[A-Za-z0-9._-]+"/revision="'$REVISION'"/;s/branch="[A-Za-z0-9._-]+"/branch="'$BRANCH'"/;s/status="[A-Za-z0-9._-]+"/status="release"/' ivy.xml | |
echo $? | |
- name: Build with Ant | |
env: | |
ROLLBAR_TOKEN: ${{ secrets.ROLLBAR_TOKEN }} | |
ROLLBAR_ENDPOINT: ${{ secrets.ROLLBAR_ENDPOINT }} | |
BRANCH: ${{ needs.workflowvars.outputs.branch }} | |
run: | | |
cd ${GITHUB_WORKSPACE}/pb | |
ant -noinput -Dbuildtype=nightly_build -Drollbar_token=$ROLLBAR_TOKEN -Drollbar_endpoint=$ROLLBAR_ENDPOINT -Dversion=$BRANCH -buildfile build.xml jar | |
- name: Create Assets | |
env: | |
FOLDERFULL: ${{ format('PhantomBot-{0}', needs.workflowvars.outputs.branch) }} | |
FOLDERLIN: PhantomBot-nightly-lin-runtime | |
FOLDERWIN: PhantomBot-nightly-win-runtime | |
FOLDERMAC: PhantomBot-nightly-mac-runtime | |
FOLDERARM64: PhantomBot-nightly-arm64-runtime | |
FOLDERARM32: PhantomBot-nightly-arm32-runtime | |
FOLDERBOT: PhantomBot-nightly-bot | |
run: | | |
cd ${GITHUB_WORKSPACE}/pb | |
echo ::group::rsync $FOLDERLIN | |
mkdir dist/$FOLDERLIN | |
rsync -rav --progress dist/$FOLDERFULL/java-runtime-linux dist/$FOLDERLIN | |
rsync -rav --progress dist/$FOLDERFULL/launch.sh dist/$FOLDERLIN | |
rsync -rav --progress dist/$FOLDERFULL/launch-service.sh dist/$FOLDERLIN | |
rsync -rav --progress dist/$FOLDERFULL/restartbot-systemctl.sh dist/$FOLDERLIN | |
rsync -rav --progress dist/$FOLDERFULL/restartbot-systemv.sh dist/$FOLDERLIN | |
echo ::endgroup:: | |
echo ::group::rsync $FOLDERWIN | |
mkdir dist/$FOLDERWIN | |
rsync -rav --progress dist/$FOLDERFULL/java-runtime dist/$FOLDERWIN | |
rsync -rav --progress dist/$FOLDERFULL/launch.bat dist/$FOLDERWIN | |
rsync -rav --progress dist/$FOLDERFULL/launch.ps1 dist/$FOLDERWIN | |
rsync -rav --progress dist/$FOLDERFULL/restartbot-windows.bat dist/$FOLDERWIN | |
echo ::endgroup:: | |
echo ::group::rsync $FOLDERMAC | |
mkdir dist/$FOLDERMAC | |
rsync -rav --progress dist/$FOLDERFULL/java-runtime-macos dist/$FOLDERMAC | |
rsync -rav --progress dist/$FOLDERFULL/launch.sh dist/$FOLDERMAC | |
rsync -rav --progress dist/$FOLDERFULL/launch-service.sh dist/$FOLDERMAC | |
echo ::endgroup:: | |
echo ::group::rsync $FOLDERARM64 | |
mkdir dist/$FOLDERARM64 | |
rsync -rav --progress dist/$FOLDERFULL/java-runtime-arm64 dist/$FOLDERARM64 | |
rsync -rav --progress dist/$FOLDERFULL/launch.sh dist/$FOLDERARM64 | |
rsync -rav --progress dist/$FOLDERFULL/launch-service.sh dist/$FOLDERARM64 | |
rsync -rav --progress dist/$FOLDERFULL/restartbot-systemctl.sh dist/$FOLDERARM64 | |
rsync -rav --progress dist/$FOLDERFULL/restartbot-systemv.sh dist/$FOLDERARM64 | |
echo ::endgroup:: | |
echo ::group::rsync $FOLDERARM32 | |
mkdir dist/$FOLDERARM32 | |
rsync -rav --progress dist/$FOLDERFULL/java-runtime-arm32 dist/$FOLDERARM32 | |
rsync -rav --progress dist/$FOLDERFULL/launch.sh dist/$FOLDERARM32 | |
rsync -rav --progress dist/$FOLDERFULL/launch-service.sh dist/$FOLDERARM32 | |
rsync -rav --progress dist/$FOLDERFULL/restartbot-systemctl.sh dist/$FOLDERARM32 | |
rsync -rav --progress dist/$FOLDERFULL/restartbot-systemv.sh dist/$FOLDERARM32 | |
echo ::endgroup:: | |
echo ::group::rsync $FOLDERBOT | |
mkdir dist/$FOLDERBOT | |
rsync -rav --progress dist/$FOLDERFULL/ dist/$FOLDERBOT --exclude java-runtime-linux --exclude java-runtime --exclude java-runtime-arm64 --exclude java-runtime-arm32 --exclude java-runtime-macos --exclude launch-docker.sh --exclude docker-entrypoint.sh --exclude restartbot-docker.sh | |
echo ::endgroup:: | |
cd dist | |
rm -rf $FOLDERFULL | |
echo ::group::zip $FOLDERLIN | |
mv -v $FOLDERLIN $FOLDERFULL | |
zip -m -9 -X -r $FOLDERLIN.zip $FOLDERFULL | |
rm -rf $FOLDERFULL | |
echo ::endgroup:: | |
echo ::group::zip $FOLDERWIN | |
mv -v $FOLDERWIN $FOLDERFULL | |
zip -m -9 -X -r $FOLDERWIN.zip $FOLDERFULL | |
rm -rf $FOLDERFULL | |
echo ::endgroup:: | |
echo ::group::zip $FOLDERMAC | |
mv -v $FOLDERMAC $FOLDERFULL | |
zip -m -9 -X -r $FOLDERMAC.zip $FOLDERFULL | |
rm -rf $FOLDERFULL | |
echo ::endgroup:: | |
echo ::group::zip $FOLDERARM64 | |
mv -v $FOLDERARM64 $FOLDERFULL | |
zip -m -9 -X -r $FOLDERARM64.zip $FOLDERFULL | |
rm -rf $FOLDERFULL | |
echo ::endgroup:: | |
echo ::group::zip $FOLDERARM32 | |
mv -v $FOLDERARM32 $FOLDERFULL | |
zip -m -9 -X -r $FOLDERARM32.zip $FOLDERFULL | |
rm -rf $FOLDERFULL | |
echo ::endgroup:: | |
echo ::group::zip $FOLDERBOT | |
mv -v $FOLDERBOT $FOLDERFULL | |
zip -m -9 -X -r $FOLDERBOT.zip $FOLDERFULL | |
rm -rf $FOLDERFULL | |
echo ::endgroup:: | |
- name: Prep Commit | |
id: prep_commit | |
env: | |
FOLDERLIN: PhantomBot-nightly-lin-runtime | |
FOLDERWIN: PhantomBot-nightly-win-runtime | |
FOLDERMAC: PhantomBot-nightly-mac-runtime | |
FOLDERARM64: PhantomBot-nightly-arm64-runtime | |
FOLDERARM32: PhantomBot-nightly-arm32-runtime | |
FOLDERBOT: PhantomBot-nightly-bot | |
REVISION: ${{ needs.workflowvars.outputs.revision }} | |
NB_REVISION: ${{ needs.workflowvars.outputs.nb_revision }} | |
run: | | |
cd ${GITHUB_WORKSPACE}/nb | |
mv -f ${GITHUB_WORKSPACE}/pb/dist/$FOLDERLIN.zip ./$FOLDERLIN.zip | |
mv -f ${GITHUB_WORKSPACE}/pb/dist/$FOLDERWIN.zip ./$FOLDERWIN.zip | |
mv -f ${GITHUB_WORKSPACE}/pb/dist/$FOLDERMAC.zip ./$FOLDERMAC.zip | |
mv -f ${GITHUB_WORKSPACE}/pb/dist/$FOLDERARM64.zip ./$FOLDERARM64.zip | |
mv -f ${GITHUB_WORKSPACE}/pb/dist/$FOLDERARM32.zip ./$FOLDERARM32.zip | |
mv -f ${GITHUB_WORKSPACE}/pb/dist/$FOLDERBOT.zip ./$FOLDERBOT.zip | |
DATEDZIP=PhantomBot-nightly-$(date +%m%d%Y.%H%M%S).zip | |
cp -f ./$FOLDERBOT.zip ./historical/${DATEDZIP} | |
COMMITSTR="Nightly Build at $(date '+%b %d %H:%M:%S %Y (%Z%z)')" | |
if [ "${NB_REVISION}" == "${REVISION}" ]; then | |
export BUILD_STR="${COMMITSTR} (Repo: ${REVISION}) (No Changes)" | |
else | |
export BUILD_STR="${COMMITSTR} (Repo: ${REVISION}) ([View Changes](https://github.com/PhantomBot/PhantomBot/compare/${NB_REVISION}...${REVISION}))" | |
fi | |
echo "commitmsg=${BUILD_STR}" >> $GITHUB_OUTPUT | |
cat builds.md | perl -e 'while(<STDIN>) { if ($_ =~ /------/ ) { print $_; print "###### $ENV{BUILD_STR}\n"; } else { print $_; } }' > builds.new | |
head -25 builds.new > builds.md | |
rm -f builds.new | |
echo ${REVISION} > last_repo_version | |
echo "gitadd=${DATEDZIP}" >> $GITHUB_OUTPUT | |
cd ${GITHUB_WORKSPACE}/nb/historical | |
find . | awk '{s=gensub(/.+-([0-9]{2})([0-9]{2})([0-9]{4})\.([0-9]{2})([0-9]{2})([0-9]{2})\.zip/, "\\3 \\1 \\2 \\4 \\5 \\6", ""); t=mktime(s); d=systime() - t; if (d >= 1728000 && length($1) > 4){ printf("timestamp: %d diff: %d\n%s\n",t, d, s);}}' 2>/dev/null | |
OLDFILES=$(find . | awk '{s=gensub(/.+-([0-9]{2})([0-9]{2})([0-9]{4})\.([0-9]{2})([0-9]{2})([0-9]{2})\.zip/, "\\3 \\1 \\2 \\4 \\5 \\6", ""); t=mktime(s); d=systime() - t; if (d >= 1728000 && length($1) > 4){ print "./historical/"$1}}' 2>/dev/null | xargs echo) | |
echo "gitrm=${OLDFILES}" >> $GITHUB_OUTPUT | |
- name: Commit Changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
fetch: false | |
cwd: ${{ env.GITHUB_WORKSPACE }}/nb | |
default_author: github_actions | |
add: ./PhantomBot-nightly-lin-runtime.zip ./PhantomBot-nightly-win-runtime.zip ./PhantomBot-nightly-mac-runtime.zip ./PhantomBot-nightly-arm64-runtime.zip ./PhantomBot-nightly-arm32-runtime.zip ./PhantomBot-nightly-bot.zip ./historical/${{ steps.prep_commit.outputs.gitadd }} ./builds.md ./last_repo_version | |
remove: ${{ steps.prep_commit.outputs.gitrm }} | |
message: ${{ steps.prep_commit.outputs.commitmsg }} | |
- name: Notify Rollbar of Deploy Failure | |
if: ${{ contains(needs.workflowvars.outputs.rollbarmissing, 'no') && (failure() || cancelled()) }} | |
uses: rollbar/[email protected] | |
with: | |
environment: "nightly_build" | |
version: ${{ needs.workflowvars.outputs.revision }} | |
status: "failed" | |
env: | |
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_WRITE_TOKEN }} | |
ROLLBAR_USERNAME: ${{ github.actor }} | |
DEPLOY_ID: ${{ steps.rollbar_deploy.outputs.deploy_id }} | |
- name: Notify Rollbar of Deploy Success | |
if: ${{ contains(needs.workflowvars.outputs.rollbarmissing, 'no') && success() }} | |
uses: rollbar/[email protected] | |
with: | |
environment: "nightly_build" | |
version: ${{ needs.workflowvars.outputs.revision }} | |
status: "succeeded" | |
env: | |
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_WRITE_TOKEN }} | |
ROLLBAR_USERNAME: ${{ github.actor }} | |
DEPLOY_ID: ${{ steps.rollbar_deploy.outputs.deploy_id }} | |
- name: Update Allowed Rollbar Versions | |
if: ${{ contains(needs.workflowvars.outputs.servermissing, 'no') && success() }} | |
env: | |
ACCESS_TOKEN: ${{ secrets.SERVER_TOKEN }} | |
URL: ${{ secrets.SERVER_URL }} | |
VERSION: ${{ needs.workflowvars.outputs.revision }} | |
run: | | |
curl -X POST $URL -H "x-access-token: $ACCESS_TOKEN" -H "Content-Type: application/json; charset=UTF-8" -d "{\"type\":\"nightly_build\",\"version\":\"$VERSION\"}" | |
docker: | |
name: Docker build on ubuntu-latest | |
runs-on: ubuntu-latest | |
needs: [buildtest, dockertest, workflowvars] | |
if: contains(needs.workflowvars.outputs.ispublished, 'no') | |
steps: | |
- name: Checkout PhantomBot Repository | |
uses: actions/checkout@v4 | |
with: | |
repository: PhantomBot/PhantomBot | |
persist-credentials: false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
- name: Login to DockerHub Registry | |
if: contains(needs.workflowvars.outputs.dockermissing, 'no') | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_CLITOKEN }} | |
logout: true | |
- name: Login to GitHub Container Registry | |
if: contains(needs.workflowvars.outputs.dryrun, 'no') | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
logout: true | |
- name: Notify Rollbar of Deploy Start | |
if: contains(needs.workflowvars.outputs.rollbarmissing, 'no') | |
id: rollbar_deploy | |
uses: rollbar/[email protected] | |
with: | |
environment: "nightly_build_docker" | |
version: ${{ needs.workflowvars.outputs.revision }} | |
status: "started" | |
env: | |
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_WRITE_TOKEN }} | |
ROLLBAR_USERNAME: ${{ github.actor }} | |
- name: Prep Ant script | |
env: | |
BRANCH: ${{ needs.workflowvars.outputs.branch }} | |
REVISION: ${{ needs.workflowvars.outputs.revision }} | |
run: | | |
sed -i -r 's/revision="[A-Za-z0-9._-]+"/revision="'$REVISION'"/;s/branch="[A-Za-z0-9._-]+"/branch="'$BRANCH'"/' ivy.xml | |
echo $? | |
- name: Build and Push DockerHub | |
if: contains(needs.workflowvars.outputs.dockermissing, 'no') | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
PROJECT_VERSION=${{ needs.workflowvars.outputs.branch }} | |
ANT_ARGS=-Dbuildtype=nightly_build -Drollbar_token=${{ secrets.ROLLBAR_TOKEN }} -Drollbar_endpoint=${{ secrets.ROLLBAR_ENDPOINT }} -Dversion=${{ needs.workflowvars.outputs.branch }} | |
tags: | | |
${{ secrets.DOCKER_REPO }}:${{ needs.workflowvars.outputs.revision }} | |
${{ secrets.DOCKER_REPO }}:latest | |
- name: Build and Push GitHub Containers | |
if: contains(needs.workflowvars.outputs.dryrun, 'no') | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
PROJECT_VERSION=${{ needs.workflowvars.outputs.branch }} | |
ANT_ARGS=-Dbuildtype=nightly_build -Dfallback.revision=${{ needs.workflowvars.outputs.revision }} -Drollbar_token=${{ secrets.ROLLBAR_TOKEN }} -Drollbar_endpoint=${{ secrets.ROLLBAR_ENDPOINT }} -Dversion=${{ needs.workflowvars.outputs.branch }} | |
tags: | | |
ghcr.io/${{ needs.workflowvars.outputs.ghcrrepo }}:${{ needs.workflowvars.outputs.revision }} | |
ghcr.io/${{ needs.workflowvars.outputs.ghcrrepo }}:latest | |
- name: Notify Rollbar of Deploy Failure | |
if: ${{ contains(needs.workflowvars.outputs.rollbarmissing, 'no') && (failure() || cancelled()) }} | |
uses: rollbar/[email protected] | |
with: | |
environment: "nightly_build_docker" | |
version: ${{ needs.workflowvars.outputs.revision }} | |
status: "failed" | |
env: | |
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_WRITE_TOKEN }} | |
ROLLBAR_USERNAME: ${{ github.actor }} | |
DEPLOY_ID: ${{ steps.rollbar_deploy.outputs.deploy_id }} | |
- name: Notify Rollbar of Deploy Success | |
if: ${{ contains(needs.workflowvars.outputs.rollbarmissing, 'no') && success() }} | |
uses: rollbar/[email protected] | |
with: | |
environment: "nightly_build_docker" | |
version: ${{ needs.workflowvars.outputs.revision }} | |
status: "succeeded" | |
env: | |
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_WRITE_TOKEN }} | |
ROLLBAR_USERNAME: ${{ github.actor }} | |
DEPLOY_ID: ${{ steps.rollbar_deploy.outputs.deploy_id }} | |
- name: Update Allowed Rollbar Versions | |
if: ${{ contains(needs.workflowvars.outputs.servermissing, 'no') && success() }} | |
env: | |
ACCESS_TOKEN: ${{ secrets.SERVER_TOKEN }} | |
URL: ${{ secrets.SERVER_URL }} | |
VERSION: ${{ needs.workflowvars.outputs.revision }} | |
run: | | |
curl -X POST $URL -H "x-access-token: $ACCESS_TOKEN" -H "Content-Type: application/json; charset=UTF-8" -d "{\"type\":\"nightly_build_docker\",\"version\":\"$VERSION\"}" |