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
69 changes: 69 additions & 0 deletions .github/workflows/cf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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 }}
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 }}" --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 }}
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/xtravels-java/.github/workflows/maven.yaml@main
secrets: inherit
deploy-cf:
needs: [tests]
uses: capire/xtravels-java/.github/workflows/cf.yaml@main
secrets: inherit
with:
environment: Production
13 changes: 9 additions & 4 deletions srv/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ management:
db.enabled: true
cds:
drafts.enforce-readonly: true
security.mock.users:
admin:
roles:
- admin
data-source.csv.paths:
- "db/data/**"
- "../db/data/**"
Expand All @@ -27,6 +23,15 @@ cds:
- "../node_modules/@capire/**"
- "../../node_modules/@capire/**"
---
spring:
config.activate.on-profile: "!cloud"

cds:
security.mock.users:
admin:
roles:
- admin
---
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AMS requires us to disable mock users in the cloud… otherwise you get cryptic errors on Java server startup:
https://github.com/capire/xtravels-java/actions/runs/21216937849/job/61040618351#step:9:969

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding that. AFAIK that's actually a known issue. @BraunMatthias Isn't this fixed yet?

spring:
config.activate.on-profile: hybrid
cds:
Expand Down