Merge branch 'development' #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
# This workflow is used to build releases | |
# It can also be called by other workflows to reuse the release flow. | |
name: DocBox Release | |
on: | |
# If you push to master|main this will trigger a stable release | |
push: | |
branches: | |
- master | |
- main | |
# Reusable workflow : Usually called by a `snapshot` workflow | |
workflow_call: | |
inputs: | |
snapshot: | |
description: 'Is this a snapshot build?' | |
required: false | |
default: false | |
type: boolean | |
env: | |
MODULE_ID: docbox | |
SNAPSHOT: ${{ inputs.snapshot || false }} | |
jobs: | |
############################################# | |
# Build Snapshot or Final Release | |
############################################# | |
build: | |
name: Build & Publish Release | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "11" | |
- name: Setup CommandBox | |
uses: Ortus-Solutions/[email protected] | |
with: | |
forgeboxAPIKey: ${{ secrets.FORGEBOX_API_TOKEN }} | |
- name: Setup Environment Variables For Build Process | |
id: current_version | |
run: | | |
echo "VERSION=`cat box.json | jq '.version' -r`" >> $GITHUB_ENV | |
box package set [email protected]@[email protected]@ | |
# master or snapshot | |
echo "Github Ref is $GITHUB_REF" | |
echo "BRANCH=master" >> $GITHUB_ENV | |
if [ $GITHUB_REF == 'refs/heads/development' ] | |
then | |
echo "BRANCH=development" >> $GITHUB_ENV | |
fi | |
- name: Install Dependencies | |
run: | | |
box install | |
- name: Update changelog [unreleased] with latest version | |
uses: thomaseizinger/[email protected] | |
if: env.SNAPSHOT == 'false' | |
with: | |
changelogPath: ./changelog.md | |
tag: v${{ env.VERSION }} | |
- name: Build ${{ env.MODULE_ID }} | |
run: | | |
# Fix changelog markdown | |
npm install -g markdownlint-cli | |
markdownlint changelog.md --fix | |
# Build it | |
box task run taskfile=build/Build target=run :version=${{ env.VERSION }} :projectName=${{ env.MODULE_ID }} :buildID=${{ github.run_number }} | |
- name: Commit Changelog [unreleased] with latest version | |
uses: EndBug/[email protected] | |
if: env.SNAPSHOT == 'false' | |
with: | |
author_name: Github Actions | |
author_email: [email protected] | |
message: 'Finalized changelog for v${{ env.VERSION }}' | |
add: changelog.md | |
- name: Tag Version | |
uses: rickstaa/[email protected] | |
if: env.SNAPSHOT == 'false' | |
with: | |
tag: "v${{ env.VERSION }}" | |
force_push_tag: true | |
message: "Latest Release v${{ env.VERSION }}" | |
- name: Upload Build Artifacts | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.MODULE_ID }} | |
path: | | |
.artifacts/**/* | |
changelog.md | |
- 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/${{ env.MODULE_ID }}" | |
DEST_DIR: "ortussolutions/${{ env.MODULE_ID }}" | |
- 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: ".artifacts/${{ env.MODULE_ID }}" | |
DEST_DIR: "ortussolutions/${{ env.MODULE_ID }}" | |
- name: Publish to ForgeBox | |
run: | | |
cd .tmp/${{ env.MODULE_ID }} | |
cat box.json | |
box forgebox publish | |
- name: Create Github Release | |
uses: taiki-e/[email protected] | |
continue-on-error: true | |
if: env.SNAPSHOT == 'false' | |
with: | |
title: ${{ env.VERSION }} | |
changelog: changelog.md | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: refs/tags/v${{ env.VERSION }} | |
- 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: '${{ env.MODULE_ID }} Built with ${{ job.status }}!' | |
SLACK_TITLE: "${{ env.MODULE_ID }} Build" | |
SLACK_USERNAME: CI | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
########################################################################################## | |
# Prep Next Release | |
########################################################################################## | |
prep_next_release: | |
name: Prep Next Release | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' | |
runs-on: ubuntu-20.04 | |
needs: [ build ] | |
steps: | |
- name: Checkout Development Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: development | |
- name: Setup CommandBox | |
uses: Ortus-Solutions/[email protected] | |
with: | |
forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }} | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.MODULE_ID }} | |
path: .tmp | |
# Copy the changelog to the development branch | |
- name: Copy Changelog | |
run: | | |
cp .tmp/changelog.md changelog.md | |
- name: Bump Version | |
run: | | |
box bump --minor --!TagVersion | |
git pull | |
- name: Commit Version Bump | |
uses: EndBug/[email protected] | |
with: | |
author_name: Github Actions | |
author_email: [email protected] | |
message: 'Version bump' | |
add: | | |
box.json | |
changelog.md |