-
Notifications
You must be signed in to change notification settings - Fork 20
71 lines (66 loc) · 2.55 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
name: Main
on:
push:
branches:
- main
jobs:
pre-build:
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.prep.outputs.image_tag }}
steps:
- uses: actions/checkout@v3
- name: Prepare
id: prep
run: |
TAG=$(echo $GITHUB_SHA | head -c7)
echo "image_tag=${TAG}" >> ${GITHUB_OUTPUT}
build-test-push:
needs: [pre-build]
uses: cyber-dojo/reusable-actions-workflows/.github/workflows/[email protected]
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
KOSLI_API_TOKEN_STAGING: ${{ secrets.KOSLI_API_TOKEN_STAGING }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
BUILD_COMMAND: build_test_publish.sh
image_tag: ${{ needs.pre-build.outputs.image_tag }}
AWS_ACCOUNT_ID: 244531986313
AWS_REGION: eu-central-1
ecr_registry: 244531986313.dkr.ecr.eu-central-1.amazonaws.com
service_name: web
gh_actions_iam_role_name: gh_actions_services
deploy-staging:
needs: [pre-build, build-test-push]
uses: cyber-dojo/reusable-actions-workflows/.github/workflows/[email protected]
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
KOSLI_API_TOKEN_STAGING: ${{ secrets.KOSLI_API_TOKEN_STAGING }}
with:
tagged_image: 244531986313.dkr.ecr.eu-central-1.amazonaws.com/web:${{ needs.pre-build.outputs.image_tag }}
AWS_ACCOUNT_ID: 244531986313
AWS_REGION: eu-central-1
gh_actions_iam_role_name: gh_actions_services
environment_url: https://beta.cyber-dojo.org
environment_name: staging
cyber_dojo_env_name_aws: aws-beta
kosli_host_production: https://app.kosli.com
kosli_host_staging: https://staging.app.kosli.com
deploy-prod:
needs: [pre-build, build-test-push, deploy-staging]
uses: cyber-dojo/reusable-actions-workflows/.github/workflows/[email protected]
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
KOSLI_API_TOKEN_STAGING: ${{ secrets.KOSLI_API_TOKEN_STAGING }}
with:
tagged_image: 274425519734.dkr.ecr.eu-central-1.amazonaws.com/web:${{ needs.pre-build.outputs.image_tag }}
AWS_ACCOUNT_ID: 274425519734
AWS_REGION: eu-central-1
gh_actions_iam_role_name: gh_actions_services
environment_url: https://cyber-dojo.org
environment_name: production
cyber_dojo_env_name_aws: aws-prod
kosli_host_production: https://app.kosli.com
kosli_host_staging: https://staging.app.kosli.com