Skip to content

cds add github-actions #3

cds add github-actions

cds add github-actions #3

Workflow file for this run

name: Cloud Foundry
on:
workflow_call:
inputs:
environment:
default: Staging
type: string
workflow_dispatch:
push:
branches:
- main
pull_request:
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 }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
- uses: actions/setup-java@v5
with:
distribution: sapmachine
java-version: 21
cache: maven
- uses: cap-js/cf-setup@v1
with:
cf-api: ${{ vars.CF_API }}
cf-org: ${{ vars.CF_ORG }}
cf-space: ${{ vars.CF_SPACE }}
cf-username: ${{ vars.CF_USERNAME }}
cf-password: ${{ secrets.CF_PASSWORD }}
- run: npm install
- 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 }}