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
7 changes: 6 additions & 1 deletion .github/actions/cf-github-deploy/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ inputs:
app-name:
description: "Base name of the deployed CAP app"
required: true
environment:
description: "Deployment environment name"
required: true

runs:
using: "composite"
Expand All @@ -21,18 +24,20 @@ runs:
uses: actions/github-script@v7
env:
URL: ${{ steps.get-url.outputs.url }}
ENVIRONMENT: ${{ inputs.environment }}
with:
script: |
const { owner, repo } = context.repo
const ref = context.ref
const url = process.env.URL
const environment = process.env.ENVIRONMENT

const deployment = await github.rest.repos.createDeployment({
owner,
repo,
ref,
required_contexts: [],
environment: 'Staging',
environment,
auto_merge: false,
description: 'Deployed to Cloud Foundry',
})
Expand Down
25 changes: 22 additions & 3 deletions .github/workflows/cf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@ name: Cloud Foundry

on:
workflow_call:
inputs:
cf-api:
description: 'Cloud Foundry API endpoint'
required: true
type: string
cf-org:
description: 'Cloud Foundry organization'
required: true
type: string
cf-space:
description: 'Cloud Foundry space'
required: true
type: string
environment:
description: 'Deployment environment name'
required: true
type: string

workflow_dispatch:
merge_group:
push:
Expand All @@ -27,9 +45,9 @@ jobs:
node-version: 22
- uses: ./.github/actions/cf-setup
with:
cf-api: ${{ vars.CF_API }}
cf-org: ${{ vars.CF_ORG }}
cf-space: ${{ vars.CF_SPACE }}
cf-api: ${{ inputs.cf-api || vars.CF_API }}
cf-org: ${{ inputs.cf-org || vars.CF_ORG }}
cf-space: ${{ inputs.cf-space || vars.CF_SPACE }}
cf-username: ${{ vars.CF_USERNAME }}
cf-password: ${{ secrets.CF_PASSWORD }}
- run: npm clean-install
Expand All @@ -38,6 +56,7 @@ jobs:
- uses: ./.github/actions/cf-github-deploy
with:
app-name: ${{ env.APP_NAME }}
environment: ${{ inputs.environment || 'Staging' }}

- run: cf logs ${{ env.APP_NAME }} --recent
- run: cf logs orders-srv --recent
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release

on:
workflow_dispatch:
release:
types: [published]

jobs:
tests:
uses: cap-sandbox/samples/.github/workflows/test.yaml@main
secrets: inherit

deploy-cf:
needs: [tests]
uses: cap-sandbox/samples/.github/workflows/cf.yaml@main
secrets: inherit
with:
cf-api: ${{ vars.CF_API_PRODUCTION }}
cf-org: ${{ vars.CF_ORG_PRODUCTION }}
cf-space: ${{ vars.CF_SPACE_PRODUCTION }}
environment: Production