-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (74 loc) · 2.79 KB
/
deploy.yaml
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: deploy
on:
workflow_run:
workflows: ["build"]
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Get GHCR package hash
id: get_package_hash
run: |
container_id=$(gh api --paginate -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/MinBZK/packages/container/ai-act-beslisboom/versions | jq -r '.[] | select(.metadata.container.tags | contains(["main"])) | .name')
echo "container_id=$container_id" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: check correct name
run: |
if [ -z "${{steps.get_package_hash.outputs.container_id}}" ]; then
echo "Variable is empty. Failing the workflow."
exit 1
fi
- uses: actions/checkout@v4
with:
repository: 'minbzk/ai-validation-infra'
ref: main
token: ${{ secrets.GH_PAT }}
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Make changes to the file
run: |
sed -i 's/newTag: .*$/newTag: main@${{ steps.get_package_hash.outputs.container_id }}/g' apps/ai-act-beslisboom/sandbox/kustomization.yaml
sed -i 's|minbzk.github.io/version: .*$|minbzk.github.io/version: main|g' apps/ai-act-beslisboom/sandbox/kustomization.yaml
git add apps/ai-act-beslisboom/sandbox/kustomization.yaml
- name: show changes
run: git diff --staged
- name: push changes
run: |
git commit -m "Update ai-act-beslisboom sandbox tag ${{ steps.get_package_hash.outputs.container_id }}"
git push --force-with-lease
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
deploy_github_pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Configure Git Identity
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
- name: Install requirements.txt
run: pip install -r 'requirements.txt'
- name: Make a folder for the diagrams
run: mkdir mermaid_graphs
- name: Generate mermaid diagrams
run: ./script/gen_mermaid.py
- name: Commit to deployment branch
run: |
git fetch
git checkout --orphan deployment
git add mermaid_graphs
git commit -m 'Auto-generate mermaid diagrams'
git push --force origin deployment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}