-
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (65 loc) · 2.39 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Sourcemeta Schemas
on:
workflow_dispatch:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref_type }}
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
packages: read
deployments: write
contents: write
env:
KRAFTCLOUD_METRO: was1
KRAFTKIT_NO_CHECK_UPDATES: true
SERVICE_DOMAIN: schemas.sourcemeta.com
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
- uses: actions/checkout@v4
- uses: chrnorm/deployment-action@v2
id: deploy-github
with:
token: '${{ github.token }}'
environment-url: https://${{ env.SERVICE_DOMAIN }}
environment: production
- id: deploy
uses: unikraft/[email protected]
with:
auths: |
github.com:
user: ${{ github.actor }}
token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
run: |
set -o errexit
set -o nounset
kraft cloud service create --name schemas --domain ${{ env.SERVICE_DOMAIN }} 443:8000 || true
kraft cloud deploy --memory 64 --rollout remove --image schemas --service schemas --kraftfile Kraftfile --restart on-failure --replicas 2 .
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://${{ env.SERVICE_DOMAIN }}
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'