Skip to content

Commit

Permalink
- Updated to new module layout
Browse files Browse the repository at this point in the history
- Updated all dependencies
- Migration to Github Actions
  • Loading branch information
lmajano committed Feb 13, 2024
1 parent c01857e commit d3d0b5e
Show file tree
Hide file tree
Showing 19 changed files with 609 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .cfformat.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@
"struct.multiline.element_count": 2,
"struct.multiline.min_length": 40,
"tab_indent": true
}
}
2 changes: 1 addition & 1 deletion .cflintrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@
"parameters": {
"TooManyFunctionsChecker.maximum" : 20
}
}
}
1 change: 1 addition & 0 deletions .github/FUNDING.YML
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patreon: ortussolutions
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
---

<!-- Thanks for reporting an issue! Please fill out the blanks below. -->

## What are the steps to reproduce this issue?

1.
2.
3.

## What happens?


## What were you expecting to happen?


## Any logs, error output, etc?


## Any other comments?


## What versions are you using?

**Operating System:**
**Package Version:**
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature Request
about: Request a new feature or enhancement
---

<!-- Thanks for taking the time to recommend a feature! Please fill out the form below -->

## Summary

<!-- High level description of what this feature is -->

## Detailed Description

<!-- Lets get into the weeds here -->

## Possible Implementation Ideas

<!-- If you already have some idea of how to implement this, this would be the place to put it -->
29 changes: 29 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Description

Please include a summary of the changes and which issue(s) is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

**Please note that all PRs must have tests attached to them**

IMPORTANT: Please review the [CONTRIBUTING.md](../CONTRIBUTING.md) file for detailed contributing guidelines.

## Issues

All PRs must have an accompanied issue. Please make sure you created it and linked it here.

## Type of change

Please delete options that are not relevant.

- [ ] Bug Fix
- [ ] Improvement
- [ ] New Feature
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## Checklist

- [ ] My code follows the style guidelines of this project [cfformat](../.cfformat.json)
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
29 changes: 29 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Pull Requests

on:
push:
branches-ignore:
- "main"
- "master"
- "development"
- "releases/v*"
pull_request:
branches:
- "releases/v*"
- development

jobs:
tests:
uses: ./.github/workflows/tests.yml
secrets: inherit

formatCheck:
name: Checks Source Code Formatting
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: Ortus-Solutions/[email protected]
with:
cmd: run-script format:check
181 changes: 181 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
name: Build a 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: 'commandbox-docbox'
SNAPSHOT: ${{ inputs.snapshot || false }}

jobs:
##########################################################################################
# Build & Publish
##########################################################################################
build:
name: Build & Publish
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- 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: 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: |
npm install -g markdownlint-cli
markdownlint changelog.md --fix
# Create the CommandBox modules folder, for some reason it is not created
mkdir -p ~/.CommandBox/cfml/modules
# Link up the module so we can do testing!
box link --force
# install dependencies
box install --production
# run the build, we use ourselves to build the docs
box task run taskfile=build/Build target=run :version=${{ env.VERSION }} :projectName=${{ env.MODULE_ID }} :buildID=${{ github.run_number }} :branch=${{ env.BRANCH }}
- name: Commit Changelog To Master
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/commandbox-modules/${{ 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: ".tmp/apidocs"
DEST_DIR: "commandbox-modules/${{ env.MODULE_ID }}/${{ env.VERSION }}"

- name: Publish To ForgeBox
run: |
cd .tmp/${{ env.MODULE_ID }}
cat box.json
box forgebox publish --force
- 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 }}

##########################################################################################
# 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:
# Checkout development
- name: Checkout Repository
uses: actions/checkout@v3
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
# Bump to next version
- name: Bump Version
run: |
box bump --minor --!TagVersion
# Commit it back to development
- 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
43 changes: 43 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build Snapshot

on:
push:
branches:
- 'development'

jobs:
##########################################################################################
# Module Tests
##########################################################################################
tests:
secrets: inherit
uses: ./.github/workflows/tests.yml

##########################################################################################
# Format Source Code
##########################################################################################
format:
name: Code Auto-Formatting
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4

- name: Auto-format
uses: Ortus-Solutions/[email protected]
with:
cmd: run-script format

- name: Commit Format Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply cfformat changes

##########################################################################################
# Release it
##########################################################################################
release:
uses: ./.github/workflows/release.yml
needs: [ tests, format ]
secrets: inherit
with:
snapshot: true
Loading

0 comments on commit d3d0b5e

Please sign in to comment.