diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0579fad..1157b6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,18 +25,18 @@ jobs: needs: tests steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v3.2.0 with: fetch-depth: 0 - name: Setup Java - uses: actions/setup-java@v2 + uses: actions/setup-java@v3.9.0 with: distribution: "temurin" java-version: "11" - name: Setup CommandBox - uses: Ortus-Solutions/setup-commandbox@main + uses: Ortus-Solutions/setup-commandbox@v2.0.1 with: forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }} @@ -52,17 +52,47 @@ jobs: then echo "BRANCH=development" >> $GITHUB_ENV fi + + - name: Update changelog [unreleased] with latest version + uses: thomaseizinger/keep-a-changelog-new-release@1.3.0 + if: github.ref == 'refs/heads/main' + with: + changelogPath: ./changelog.md + tag: v${{ env.VERSION }} + - name: Build ${{ env.MODULE_ID }} run: | box install commandbox-docbox 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/add-and-commit@v9.1.1 + if: github.ref == 'refs/heads/main' + 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.6.1 + if: github.ref == 'refs/heads/main' + 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@v2 + 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: @@ -74,11 +104,23 @@ jobs: SOURCE_DIR: ".artifacts/${{ env.MODULE_ID }}" DEST_DIR: "ortussolutions/coldbox-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: "coldbox-modules/${{ env.MODULE_ID }}/${{ env.VERSION }}" + - name: Publish To ForgeBox run: | cd ${GITHUB_WORKSPACE}/.tmp/${{ env.MODULE_ID }} cat box.json box forgebox publish + - name: Inform Slack if: ${{ always() }} uses: rtCamp/action-slack-notify@v2 @@ -90,3 +132,50 @@ jobs: 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/main' + runs-on: ubuntu-20.04 + 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: ${{ 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 --patch --!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 [ci skip]' + add: | + box.json + changelog.md \ No newline at end of file