Skip to content

Enable HCQL V2 (#85) #47

Enable HCQL V2 (#85)

Enable HCQL V2 (#85) #47

Workflow file for this run

name: Cloud Foundry
on:
workflow_call:
inputs:
environment:
default: Staging
type: string
workflow_dispatch:
push:
branches:
- main
permissions:
contents: read
deployments: write
packages: read
concurrency:
group: cf-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
APP_NAME: xtravels
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
FORCE_COLOR: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
registry-url: https://npm.pkg.github.com/
- uses: actions/setup-java@v5
with:
distribution: sapmachine
java-version: 25
cache: maven
- uses: cap-js/cf-setup@v2
with:
api: ${{ vars.CF_API }}
org: ${{ vars.CF_ORG }}
space: ${{ vars.CF_SPACE }}
username: ${{ vars.CF_USERNAME }}
password: ${{ secrets.CF_PASSWORD }}
- run: npm install
- name: Set xflights URL
env:
ENVIRONMENT: ${{ inputs.environment || 'Staging' }}
run: |
xflights=$(
gh api --method GET "repos/capire/xflights-java/deployments?environment=$ENVIRONMENT&per_page=1" --jq '.[0].id' \
| xargs -I% gh api "repos/capire/xflights-java/deployments/%/statuses" --jq '.[] | select(.state=="success") | .environment_url' \
| head -1
)
echo "Connecting to xflights at $xflights"
sed -i "s|XFLIGHTS_URL:.*|XFLIGHTS_URL: $xflights|" mta.yaml
- run: npx cds up
- run: cf logs "${{ env.APP_NAME }}" --recent
if: always()
- run: cf logs "${{ env.APP_NAME }}-srv" --recent
if: always()
- run: cf logs "${{ env.APP_NAME }}-db-deployer" --recent
if: always()
- name: Get application URL
id: route
shell: bash
run: |
host=$(cf app "${APP_NAME}" | awk '/routes:/ {print $2}' | sed -E 's#^https?://##; s/,.*$//')
echo "url=https://$host" >> "$GITHUB_OUTPUT"
environment:
name: ${{ inputs.environment || 'Staging' }}
url: ${{ steps.route.outputs.url }}