Nightly Build #1547
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: | |
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@v3 | |
with: | |
persist-credentials: false | |
path: nb | |
- name: Checkout PhantomBot Repository | |
uses: actions/checkout@v3 | |
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 }} | |
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}" ]; 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@v3 | |
with: | |
repository: PhantomBot/PhantomBot | |
persist-credentials: false | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
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@v3 | |
with: | |
repository: PhantomBot/PhantomBot | |
persist-credentials: false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: linux/amd64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
driver-opts: network=host | |
- name: Build Docker | |
uses: docker/build-push-action@v4 | |
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@v3 | |
with: | |
path: nb | |
- name: Checkout PhantomBot Repository | |
uses: actions/checkout@v3 | |
with: | |
repository: PhantomBot/PhantomBot | |
path: pb | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
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 | |
FOLDERWIN: PhantomBot-nightly-win | |
FOLDERMAC: PhantomBot-nightly-mac | |
FOLDERARMBSDOTHER: PhantomBot-nightly-arm-bsd-other | |
run: | | |
cd ${GITHUB_WORKSPACE}/pb | |
mkdir dist/$FOLDERLIN | |
rsync -rav --progress dist/$FOLDERFULL dist/$FOLDERLIN --exclude java-runtime --exclude java-runtime-macos --exclude launch.bat --exclude launch-bsd.sh --exclude launch-bsd-service.sh --exclude launch-docker.sh --exclude docker-entrypoint.sh --exclude restartbot.bat --exclude restartbot-bsd.sh --exclude restartbot-docker.sh | |
mkdir dist/$FOLDERWIN | |
rsync -rav --progress dist/$FOLDERFULL dist/$FOLDERWIN --exclude java-runtime-linux --exclude java-runtime-macos --exclude launch.sh --exclude launch-service.sh --exclude launch-bsd.sh --exclude launch-bsd-service.sh --exclude launch-docker.sh --exclude docker-entrypoint.sh --exclude restartbot.sh --exclude restartbot-bsd.sh --exclude restartbot-docker.sh | |
mkdir dist/$FOLDERMAC | |
rsync -rav --progress dist/$FOLDERFULL dist/$FOLDERMAC --exclude java-runtime-linux --exclude java-runtime --exclude launch.bat --exclude launch-bsd.sh --exclude launch-bsd-service.sh --exclude launch-docker.sh --exclude docker-entrypoint.sh --exclude restartbot.bat --exclude restartbot-bsd.sh --exclude restartbot-docker.sh | |
mkdir dist/$FOLDERARMBSDOTHER | |
rsync -rav --progress dist/$FOLDERFULL dist/$FOLDERARMBSDOTHER --exclude java-runtime-linux --exclude java-runtime --exclude java-runtime-macos --exclude launch.bat --exclude launch-docker.sh --exclude docker-entrypoint.sh --exclude restartbot.bat --exclude restartbot.sh --exclude restartbot-docker.sh | |
cd dist | |
rm -rf $FOLDERFULL | |
echo Zip Lin | |
mv -v $FOLDERLIN $FOLDERFULL | |
cd $FOLDERFULL | |
zip -m -9 -X -r $FOLDERLIN.zip $FOLDERFULL | |
cd .. | |
mv -v $FOLDERFULL/$FOLDERLIN.zip ./$FOLDERLIN.zip | |
rm -rf $FOLDERFULL | |
echo Zip Win | |
mv -v $FOLDERWIN $FOLDERFULL | |
cd $FOLDERFULL | |
zip -m -9 -X -r $FOLDERWIN.zip $FOLDERFULL | |
cd .. | |
mv -v $FOLDERFULL/$FOLDERWIN.zip ./$FOLDERWIN.zip | |
rm -rf $FOLDERFULL | |
echo Zip Mac | |
mv -v $FOLDERMAC $FOLDERFULL | |
cd $FOLDERFULL | |
zip -m -9 -X -r $FOLDERMAC.zip $FOLDERFULL | |
cd .. | |
mv -v $FOLDERFULL/$FOLDERMAC.zip ./$FOLDERMAC.zip | |
rm -rf $FOLDERFULL | |
echo Zip Arm/BSD/Other | |
mv -v $FOLDERARMBSDOTHER $FOLDERFULL | |
cd $FOLDERFULL | |
zip -m -9 -X -r $FOLDERARMBSDOTHER.zip $FOLDERFULL | |
cd .. | |
mv -v $FOLDERFULL/$FOLDERARMBSDOTHER.zip ./$FOLDERARMBSDOTHER.zip | |
rm -rf $FOLDERFULL | |
- name: Prep Commit | |
id: prep_commit | |
env: | |
FOLDERLIN: PhantomBot-nightly-lin | |
FOLDERWIN: PhantomBot-nightly-win | |
FOLDERMAC: PhantomBot-nightly-mac | |
FOLDERARMBSDOTHER: PhantomBot-nightly-arm-bsd-other | |
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/$FOLDERARMBSDOTHER.zip ./$FOLDERARMBSDOTHER.zip | |
DATEDZIP=PhantomBot-nightly-$(date +%m%d%Y.%H%M%S).zip | |
cp -f ./$FOLDERARMBSDOTHER.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 "##[set-output name=commitmsg;]$(echo ${BUILD_STR})" | |
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 "##[set-output name=gitadd;]$(echo ${DATEDZIP})" | |
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 "##[set-output name=gitrm;]$(echo ${OLDFILES})" | |
- name: Commit Changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
cwd: ${{ env.GITHUB_WORKSPACE }}/nb | |
default_author: github_actions | |
add: ./PhantomBot-nightly-lin.zip ./PhantomBot-nightly-win.zip ./PhantomBot-nightly-mac.zip ./PhantomBot-nightly-arm-bsd-other.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@v3 | |
with: | |
repository: PhantomBot/PhantomBot | |
persist-credentials: false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
- name: Login to DockerHub Registry | |
if: contains(needs.workflowvars.outputs.dockermissing, 'no') | |
uses: docker/login-action@v2 | |
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@v2 | |
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@v4 | |
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@v4 | |
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\"}" |