fixed location of assets #9
This file contains hidden or 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: Build Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| # Reusable workflow | |
| workflow_call: | |
| inputs: | |
| snapshot: | |
| description: 'Is this a snapshot build' | |
| required: false | |
| default: true | |
| type: boolean | |
| # Manual Trigger | |
| workflow_dispatch: | |
| inputs: | |
| snapshot: | |
| description: 'Is this a snapshot build' | |
| required: false | |
| default: false | |
| type: boolean | |
| versionType: | |
| description: 'Bump Version' | |
| required: false | |
| default: 'minor' | |
| type: choice | |
| options: | |
| - minor | |
| - patch | |
| env: | |
| SNAPSHOT: ${{ inputs.snapshot || false }} | |
| VERSION_TYPE: ${{ inputs.versionType || false }} | |
| jobs: | |
| ############################################# | |
| # Build & Publish | |
| ############################################# | |
| build: | |
| name: Build & Publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "21" | |
| - name: Setup CommandBox | |
| uses: Ortus-Solutions/setup-commandbox@v2.0.1 | |
| with: | |
| forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }} | |
| - name: Prepare For Build | |
| run: | | |
| export VERSION=`cat box.json | jq '.version' -r` | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| # 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 | |
| box package set version=$VERSION-snapshot | |
| else | |
| box package set version=$VERSION+${{ github.run_number }} | |
| fi | |
| - name: Update changelog [unreleased] with latest version release | |
| uses: thomaseizinger/keep-a-changelog-new-release@3.1.0 | |
| if: env.SNAPSHOT == 'false' | |
| with: | |
| changelogPath: ./changelog.md | |
| tag: v${{ env.VERSION }} | |
| - name: Lint Changelog | |
| if: env.SNAPSHOT == 'false' | |
| run: | | |
| npm install -g markdownlint-cli | |
| markdownlint changelog.md --fix | |
| - name: Commit Changelog | |
| uses: EndBug/add-and-commit@v9.1.4 | |
| if: env.SNAPSHOT == 'false' | |
| with: | |
| author_name: Github Actions | |
| author_email: info@ortussolutions.com | |
| message: 'Finalized changelog for v${{ env.VERSION }}' | |
| add: changelog.md | |
| - name: Tag Version | |
| uses: rickstaa/action-create-tag@v1.7.2 | |
| if: env.SNAPSHOT == 'false' | |
| with: | |
| tag: "v${{ env.VERSION }}" | |
| force_push_tag: true | |
| message: "Latest Release v${{ env.VERSION }}" | |
| - name: Publish To ForgeBox | |
| run: | | |
| cat box.json | |
| box forgebox publish --force | |
| - name: Create Github Release | |
| uses: taiki-e/create-gh-release-action@v1.8.4 | |
| 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: Upload Build Artifacts | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-template | |
| path: | | |
| box.json | |
| changelog.md | |
| ########################################################################################## | |
| # Prep Next Release | |
| ########################################################################################## | |
| prep_next_release: | |
| name: Prep Next Release | |
| if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| needs: [ build ] | |
| steps: | |
| # Checkout development | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: development | |
| - name: Setup CommandBox | |
| uses: Ortus-Solutions/setup-commandbox@v2.0.1 | |
| with: | |
| forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }} | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: app-template | |
| 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/add-and-commit@v9.1.4 | |
| with: | |
| author_name: Github Actions | |
| author_email: info@ortussolutions.com | |
| message: 'Version bump' | |
| add: | | |
| box.json | |
| changelog.md |