|
| 1 | +name: Build Cloud Cap Samples Java |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [multi_tenant_deploy] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + cf_space: |
| 9 | + description: 'Specify the Cloud Foundry space to deploy to' |
| 10 | + required: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: cap-java |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout this repository |
| 18 | + uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Set up JDK 21 |
| 21 | + uses: actions/setup-java@v3 |
| 22 | + with: |
| 23 | + distribution: 'temurin' |
| 24 | + java-version: '21' |
| 25 | + |
| 26 | + - name: Setup Node.js |
| 27 | + uses: actions/setup-node@v3 |
| 28 | + with: |
| 29 | + node-version: '18' # Change this to at least version 18 |
| 30 | + |
| 31 | + - name: Install MBT |
| 32 | + run: npm install -g mbt |
| 33 | + |
| 34 | + - name: Clone the cloud-cap-samples-java repo |
| 35 | + run: git clone --depth 1 --branch main https://github.com/vibhutikumar07/cloud-cap-samples-java.git |
| 36 | + |
| 37 | + - name: Change directory to cloud-cap-samples-java |
| 38 | + working-directory: cloud-cap-samples-java |
| 39 | + run: pwd # Verifies that we're in the correct directory |
| 40 | + |
| 41 | + - name: Run mbt build |
| 42 | + working-directory: cloud-cap-samples-java |
| 43 | + run: | |
| 44 | + echo "java version" |
| 45 | + java --version |
| 46 | + mbt build |
| 47 | + - name: Deploy to Cloud Foundry |
| 48 | + working-directory: cloud-cap-samples-java |
| 49 | + run: | |
| 50 | + echo "Deploying to ${{ github.event.inputs.cf_space }}......" |
| 51 | + |
| 52 | + # Install cf CLI plugin |
| 53 | + cf install-plugin multiapps -f |
| 54 | + # Login to Cloud Foundry again to ensure session is active |
| 55 | + #cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ github.event.inputs.cf_space }} |
| 56 | + cf login -a ${{ secrets.CF_API }} -u ${{ secrets.CF_USER }} -p ${{ secrets.CF_PASSWORD }} -o ${{ secrets.CF_ORG }} -s ${{ secrets.CF_SPACE_RISHI }} |
| 57 | + # Deploy the application |
| 58 | + echo "Current directory.." |
| 59 | + pwd |
| 60 | + ls -lrth |
| 61 | + echo "Running cf deploy" |
| 62 | + cf deploy mta_archives/bookshop-mt_1.0.0.mtar -f |
0 commit comments