|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: CI |
| 4 | + |
| 5 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 6 | +# events but only for the master branch |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - development |
| 12 | + pull_request: |
| 13 | + branches: |
| 14 | + - development |
| 15 | + |
| 16 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + # The type of runner that the job will run on |
| 20 | + runs-on: ubuntu-latest |
| 21 | + env: |
| 22 | + MODULE_ID: blobstoragesdk |
| 23 | + ACTIONS_ALLOW_UNSECURE_COMMANDS: true |
| 24 | + |
| 25 | + |
| 26 | + steps: |
| 27 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 28 | + - uses: actions/checkout@v2 |
| 29 | + |
| 30 | + - name: Setup Java JDK |
| 31 | + |
| 32 | + with: |
| 33 | + # The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28 |
| 34 | + java-version: 11 |
| 35 | + |
| 36 | + - name: Install CommandBox |
| 37 | + run: | |
| 38 | + curl -fsSl https://downloads.ortussolutions.com/debs/gpg | sudo apt-key add - |
| 39 | + sudo echo "deb http://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a /etc/apt/sources.list.d/commandbox.list |
| 40 | + sudo apt-get update && sudo apt-get --assume-yes install rsync jq commandbox |
| 41 | + box install commandbox-cfconfig,commandbox-dotenv,commandbox-docbox |
| 42 | + box config set endpoints.forgebox.APIToken=${{ secrets.FORGEBOX_API_KEY }} > /dev/null |
| 43 | +
|
| 44 | +
|
| 45 | + - name: Do Build |
| 46 | + run: | |
| 47 | + # Set Current Version |
| 48 | + TARGET_VERSION=`cat ${{github.workspace}}/box.json | jq '.version' -r` |
| 49 | + echo "::set-env name=TARGET_VERSION::$TARGET_VERSION" |
| 50 | + echo "Starting build for $MODULE_ID v$TARGET_VERSION" |
| 51 | + # Replace version so builder can issue it |
| 52 | + |
| 53 | + box install |
| 54 | +
|
| 55 | + # move back to build dir to build it |
| 56 | + cd ${{github.workspace}} |
| 57 | + # Build Project |
| 58 | + box task run taskfile=build/Build target=run :version=$TARGET_VERSION :projectName=$MODULE_ID :buildID=${{github.run_number}} :branch=${{github.ref}} |
| 59 | +
|
| 60 | + - name: Upload Package to S3 |
| 61 | + uses: jakejarvis/[email protected] |
| 62 | + if: |
| 63 | + contains(' |
| 64 | + refs/heads/master |
| 65 | + refs/heads/development |
| 66 | + ', github.ref) |
| 67 | + with: |
| 68 | + args: --acl public-read |
| 69 | + env: |
| 70 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} |
| 71 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }} |
| 72 | + AWS_S3_BUCKET: downloads.ortussolutions.com |
| 73 | + SOURCE_DIR: ${{github.workspace}}/.artifacts/$MODULE_ID |
| 74 | + DEST_DIR: ortussolutions/$MODULE_ID |
| 75 | +
|
| 76 | + - name: Upload API Docs to S3 |
| 77 | + uses: jakejarvis/[email protected] |
| 78 | + if: |
| 79 | + contains(' |
| 80 | + refs/heads/master |
| 81 | + refs/heads/development |
| 82 | + ', github.ref) |
| 83 | + with: |
| 84 | + args: --acl public-read |
| 85 | + env: |
| 86 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} |
| 87 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }} |
| 88 | + AWS_S3_BUCKET: apidocs.ortussolutions.com |
| 89 | + SOURCE_DIR: ${{github.workspace}}/.tmp/apidocs |
| 90 | + DEST_DIR: $MODULE_ID/$TARGET_VERSION |
| 91 | +
|
| 92 | + - name: Publish to ForgeBox |
| 93 | + if: |
| 94 | + contains(' |
| 95 | + refs/heads/master |
| 96 | + refs/heads/development |
| 97 | + ', github.ref) |
| 98 | + run: | |
| 99 | + cd ${{github.workspace}}/.tmp/${MODULE_ID} |
| 100 | + cat box.json |
| 101 | + box config set ENDPOINTS.FORGEBOX.APITOKEN=${{ secrets.BOX_CONFIG_ENDPOINTS_FORGEBOX_APITOKEN }} |
| 102 | + box forgebox publish |
0 commit comments