forked from InseeFrLab/onyxia
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (133 loc) 路 4.91 KB
/
Copy pathci.yaml
File metadata and controls
139 lines (133 loc) 路 4.91 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: ci
on:
push:
branches:
- main
- v*
pull_request:
branches:
- main
permissions:
actions: read
contents: write
pages: write
jobs:
test_web:
runs-on: ubuntu-latest
steps:
- uses: InseeFrLab/onyxia@gh-actions
with:
action_name: checkout
sub_directory: web
- uses: actions/setup-node@v4.1.0
# Install dependencies with caching
- uses: bahmutov/npm-install@e5fe105da2400070b5345aeb71fcb1ef5d4b2d1f
env:
XDG_CACHE_HOME: "/home/runner/.cache/yarn"
- run: yarn test
- run: yarn build
- run: npx keycloakify build
test_helm-chart:
runs-on: ubuntu-latest
steps:
- uses: InseeFrLab/onyxia@gh-actions
with:
action_name: checkout
sub_directory: helm-chart
- uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4
- run: helm lint .
prepare_release:
needs:
- test_web
- test_helm-chart
runs-on: ubuntu-latest
outputs:
new_web_docker_image_tags: ${{steps._.outputs.new_web_docker_image_tags}}
new_chart_version: ${{steps._.outputs.new_chart_version}}
release_name: ${{steps._.outputs.release_name}}
release_body: ${{steps._.outputs.release_body}}
release_tag_name: ${{steps._.outputs.release_tag_name}}
target_commit: ${{steps._.outputs.target_commit}}
web_tag_name: ${{steps._.outputs.web_tag_name}}
steps:
# NOTE: The code for this action is in the gh-actions branch of this repo
- uses: InseeFrLab/onyxia@gh-actions
id: _
with:
action_name: prepare_release
publish_web_docker_image:
runs-on: ubuntu-latest
needs: prepare_release
if: >-
needs.prepare_release.outputs.new_web_docker_image_tags != '' &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
steps:
- uses: InseeFrLab/onyxia@gh-actions
with:
action_name: checkout
sub_directory: web
sha: ${{needs.prepare_release.outputs.target_commit}}
- uses: docker/setup-qemu-action@v3.0.0
- uses: docker/setup-buildx-action@v3.0.0
- uses: docker/login-action@v3.0.0
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
push: true
context: .
tags: ${{needs.prepare_release.outputs.new_web_docker_image_tags}}
platforms: "${{ needs.prepare_release.outputs.new_chart_version != '' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}"
cache-from: type=gha
cache-to: type=gha,mode=min
release:
runs-on: ubuntu-latest
needs: prepare_release
if: >-
needs.prepare_release.outputs.new_chart_version != '' &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
steps:
- uses: InseeFrLab/onyxia@gh-actions
with:
action_name: checkout
sub_directory: web
sha: ${{needs.prepare_release.outputs.target_commit}}
- uses: actions/setup-node@v4.1.0
# Install dependencies with caching
- uses: bahmutov/npm-install@e5fe105da2400070b5345aeb71fcb1ef5d4b2d1f
env:
XDG_CACHE_HOME: "/home/runner/.cache/yarn"
- run: yarn build-keycloak-theme
env:
KEYCLOAKIFY_THEME_VERSION: ${{needs.prepare_release.outputs.new_chart_version}}
- uses: yogeshlonkar/wait-for-jobs@722e963a0bba35f55913d5372cd442f038a7c95a
with:
ignore-skipped: true
jobs: publish_web_docker_image
ttl: 40
no-max-ttl: true
- uses: InseeFrLab/onyxia@gh-actions
with:
action_name: release_helm_chart
sha: ${{needs.prepare_release.outputs.target_commit}}
- uses: InseeFrLab/onyxia@gh-actions
if: needs.prepare_release.outputs.web_tag_name != ''
with:
action_name: create_tag
tag_name: ${{needs.prepare_release.outputs.web_tag_name}}
sha: ${{needs.prepare_release.outputs.target_commit}}
- uses: softprops/action-gh-release@v1
with:
name: ${{needs.prepare_release.outputs.release_name}}
body: ${{needs.prepare_release.outputs.release_body}}
tag_name: ${{needs.prepare_release.outputs.release_tag_name}}
target_commitish: ${{needs.prepare_release.outputs.target_commit}}
prerelease: ${{contains(needs.prepare_release.outputs.new_chart_version, '-rc.')}}
generate_release_notes: true
files: |
dist_keycloak/*.jar
onyxia-${{needs.prepare_release.outputs.new_chart_version}}.tgz
env:
# NOTE: We can't use github.token because it would not trigger the dispatch workflow.
GITHUB_TOKEN: ${{secrets.MY_GITHUB_TOKEN}}