Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/cf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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: xflights
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: 21
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
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

- run: npx cds up

- run: cf logs "${{ env.APP_NAME }}-srv" --recent
if: always()
- run: cf logs "${{ env.APP_NAME }}-db-deployer" --recent
if: always()

- name: Get backend URL
id: route
shell: bash
run: |
host=$(cf app "${APP_NAME}-srv" | 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 }}
22 changes: 22 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release

on:
workflow_dispatch:
release:
types: [published]

permissions:
contents: read
deployments: write
packages: read

jobs:
tests:
uses: capire/xflights-java/.github/workflows/maven.yaml@main
secrets: inherit
deploy-cf:
needs: [tests]
uses: capire/xflights-java/.github/workflows/cf.yaml@main
secrets: inherit
with:
environment: Production