Merge pull request #579 from Ortus-Solutions/gpickin-patch-1 #1
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: ContentBox CI | |
# Only on Development we build snapshots | |
on: | |
push: | |
branches: | |
- development | |
- master | |
jobs: | |
############################################# | |
# Tests First baby! We fail, no build :( | |
############################################# | |
tests: | |
uses: ./.github/workflows/tests.yml | |
secrets: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
############################################# | |
# Build ContentBox | |
############################################# | |
build: | |
name: Build & Publish | |
needs: tests | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: "adopt" | |
java-version: "11" | |
- name: Setup CommandBox CLI | |
uses: Ortus-Solutions/[email protected] | |
with: | |
forgeboxAPIKey: ${{ secrets.FORGEBOX_API_TOKEN }} | |
version: 5.5.2 | |
- name: Install Build Dependencies | |
run: | | |
box install --production | |
box install commandbox-docbox | |
cd modules/contentbox && box install --production | |
# Focal ships with node 16.x so we need to update to 18 | |
- name: Install Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Compile Release Assets | |
run: | | |
node -v | |
npm -v | |
npm install && npm run prod | |
cd modules/contentbox/themes/default | |
npm install && npm run prod | |
cd $GITHUB_WORKSPACE | |
rm -rf node_modules | |
rm -rf modules/contentbox/themes/default/node_modules | |
- name: Compile Release Static assets | |
run: | | |
npm install && npm run prod | |
cd modules/contentbox/themes/default | |
npm install && npm run prod | |
cd $GITHUB_WORKSPACE | |
rm -rf node_modules | |
rm -rf modules/contetnbox/themes/default/node_modules | |
- name: Setup Environment Variables For Build Process | |
id: current_version | |
run: | | |
echo "VERSION=`cat box.json | jq '.version' -r`" >> $GITHUB_ENV | |
# master or snapshot | |
echo "BRANCH=master" >> $GITHUB_ENV | |
if [ $GITHUB_REF == 'refs/heads/development' ] | |
then | |
echo "BRANCH=development" >> $GITHUB_ENV | |
fi | |
- name: Download Test Artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: tests/results | |
- name: Build Docs | |
run: | | |
# Normalize swagger doc results | |
cp -v tests/results/contentbox-test-results-lucee@5/contentbox-swagger.json tests/results/ | |
#ls -lR tests/results | |
# Run Docs Build | |
box run-script build:allDocs | |
- name: Build ContentBox Variants for ${{ env.BRANCH }} v${{ env.VERSION }} | |
run: | | |
ant -Dcontentbox.version=${{ env.VERSION }} -Dbuild.number=${{ github.run_number }} -Dbuild.branch=${{ env.BRANCH }} -f build/build.xml | |
cat build/build-contentbox/module/box.json | |
- name: List Variants | |
run: ls -R | |
working-directory: build/build-contentbox | |
- name: Upload Build Artifacts | |
if: success() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: contentbox-variants | |
path: | | |
artifacts/**/* | |
- name: Upload Binaries to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read | |
env: | |
AWS_S3_BUCKET: "downloads.ortussolutions.com" | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }} | |
SOURCE_DIR: "artifacts" | |
DEST_DIR: "ortussolutions" | |
- name: Upload API Docs to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read | |
env: | |
AWS_S3_BUCKET: "apidocs.ortussolutions.com" | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }} | |
SOURCE_DIR: "build/build-contentbox/apidocs" | |
DEST_DIR: "contentbox/${{ env.VERSION }}" | |
- name: Publish | |
run: | | |
ROOT_DIR=`pwd` | |
cd $ROOT_DIR/build/build-contentbox/module && box forgebox publish | |
cd $ROOT_DIR/build/build-contentbox/site && box forgebox publish | |
cd $ROOT_DIR/build/build-contentbox/installer && box forgebox publish | |
cd $ROOT_DIR/build/build-contentbox/installer-module && box forgebox publish | |
- name: Inform Slack | |
if: ${{ always() }} | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: coding | |
SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff' | |
SLACK_ICON_EMOJI: ":bell:" | |
SLACK_MESSAGE: 'ContentBox Built with ${{ job.status }}!' | |
SLACK_TITLE: "ContentBox Build" | |
SLACK_USERNAME: CI | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} |