Skip to content

Commit

Permalink
Integrate with GitHub Deployments
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti committed Aug 6, 2024
1 parent 3d84287 commit 413befe
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ jobs:
runs-on: ubuntu-latest
permissions:
packages: read
deployments: write
contents: write
env:
KRAFTCLOUD_METRO: was1
KRAFTKIT_VERSION: 0.9.1
KRAFTKIT_NO_CHECK_UPDATES: true
SERVICE_URL: https://schemas.intelligence.ai
steps:
- uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
Expand All @@ -28,6 +30,13 @@ jobs:

- uses: actions/checkout@v4

- uses: chrnorm/deployment-action@v2
id: deploy-github
with:
token: '${{ github.token }}'
environment-url: ${{ env.SERVICE_URL }}
environment: production

- id: deploy
uses: unikraft/[email protected]
with:
Expand All @@ -38,10 +47,26 @@ jobs:
run: |
set -o errexit
set -o nounset
kraft cloud service create --name schemas --domain schemas.intelligence.ai 443:8000 || true
kraft cloud service create --name schemas --domain ${{ env.SERVICE_URL }} 443:8000 || true
kraft cloud deploy --memory 64 --rollout remove --image schemas --service schemas --kraftfile Kraftfile
kraft cloud service get schemas
kraft cloud instance logs "$(kraft cloud service get schemas --output json | jq --raw-output '.[0].instances | split(" ") | .[0]')"
curl --location --fail https://schemas.intelligence.ai
curl --location --fail ${{ env.SERVICE_URL }}
env:
KRAFTCLOUD_TOKEN: ${{ secrets.KRAFTCLOUD_TOKEN }}

# Update deployment status
- if: ${{ steps.deploy.outcome == 'success' }}
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
environment-url: '${{ steps.deploy-github.outputs.environment_url }}'
deployment-id: '${{ steps.deploy-github.outputs.deployment_id }}'
state: 'success'
- if: ${{ steps.deploy.outcome != 'success' }}
uses: chrnorm/deployment-status@v2
with:
token: '${{ github.token }}'
environment-url: '${{ steps.deploy-github.outputs.environment_url }}'
deployment-id: '${{ steps.deploy-github.outputs.deployment_id }}'
state: 'failure'

0 comments on commit 413befe

Please sign in to comment.