Skip to content

Commit e7ab4eb

Browse files
committed
feat(release): add support for monorepo architecture
Signed-off-by: Emilien Escalle <[email protected]>
1 parent 73fb130 commit e7ab4eb

File tree

17 files changed

+415
-415
lines changed

17 files changed

+415
-415
lines changed

.github/workflows/__prepare-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
permissions:
1616
contents: read
1717
pull-requests: write
18+
id-token: write # Needed for getting local workflow actions
1819
with:
1920
github-app-id: ${{ vars.CI_BOT_APP_ID }}
2021
secrets:

.github/workflows/clean-deploy-argocd-app-of-apps.yml

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ jobs:
5050
permissions:
5151
contents: read
5252
pull-requests: write
53-
# FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659
54-
id-token: write
53+
id-token: write # Needed for getting local workflow actions
5554
steps:
5655
- id: check-client-payload
5756
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
@@ -75,23 +74,11 @@ jobs:
7574
with:
7675
persist-credentials: false
7776

78-
# jscpd:ignore-start
79-
# FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659
80-
- id: oidc
81-
uses: ChristopherHX/oidc@73eee1ff03fdfce10eda179f617131532209edbd # v3
82-
83-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
77+
- id: local-workflow-actions
78+
uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@a55670b58d3e064526201acde6c720ede638420c # 0.31.0
8479
with:
85-
persist-credentials: false
86-
path: ./self-workflow
87-
repository: ${{ steps.oidc.outputs.job_workflow_repo_name_and_owner }}
88-
ref: ${{ steps.oidc.outputs.job_workflow_repo_ref }}
89-
sparse-checkout: |
90-
actions
91-
- run: |
92-
if [ -f .gitignore ]; then grep -q "self-workflow" .gitignore || echo "self-workflow" >> .gitignore; else echo "self-workflow" >> .gitignore; fi
93-
if [ -f .dockerignore ]; then grep -q "self-workflow" .dockerignore || echo "self-workflow" >> .dockerignore; else echo "self-workflow" >> .dockerignore; fi
94-
# jscpd:ignore-end
80+
actions-path: actions
81+
9582
- id: get-manifest-files
9683
uses: ./self-workflow/actions/argocd/get-manifest-files
9784
with:
@@ -141,13 +128,11 @@ jobs:
141128
142129
[skip ci]
143130
144-
# FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659
145-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
146-
if: always() && steps.oidc.outputs.job_workflow_repo_name_and_owner
131+
# jscpd:ignore-start
132+
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@a55670b58d3e064526201acde6c720ede638420c # 0.31.0
133+
if: always() && steps.local-workflow-actions.outputs.repository
147134
with:
148-
persist-credentials: false
149-
path: ./self-workflow
150-
repository: ${{ steps.oidc.outputs.job_workflow_repo_name_and_owner }}
151-
ref: ${{ steps.oidc.outputs.job_workflow_repo_ref }}
152-
sparse-checkout: |
153-
actions
135+
actions-path: actions
136+
repository: ${{ steps.local-workflow-actions.outputs.repository }}
137+
ref: ${{ steps.local-workflow-actions.outputs.ref }}
138+
# jscpd:ignore-end

.github/workflows/clean-deploy.yml

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,14 @@ on:
6666
GitHub App private key to generate GitHub token in place of github-token.
6767
See https://github.com/actions/create-github-app-token.
6868
69-
permissions:
70-
contents: write
71-
issues: write
72-
packages: write
73-
pull-requests: write
74-
actions: read
75-
deployments: write
76-
# FIXME: This is a workaround for having workflow ref. See https://github.com/orgs/community/discussions/38659
77-
id-token: write
69+
permissions: {}
7870

7971
jobs:
8072
prepare-clean-deploy:
8173
name: Check if should clean deploy
8274
runs-on: ${{ fromJson(inputs.runs-on) }}
75+
permissions:
76+
issues: write
8377
outputs:
8478
trigger: ${{ steps.trigger.outputs.trigger }}
8579
steps:
@@ -117,30 +111,26 @@ jobs:
117111
runs-on: ${{ fromJson(inputs.runs-on) }}
118112
needs: prepare-clean-deploy
119113
if: needs.prepare-clean-deploy.outputs.trigger
114+
permissions:
115+
actions: read
116+
deployments: write
117+
issues: write
118+
pull-requests: write
119+
id-token: write # Needed for getting local workflow actions
120120
steps:
121-
# jscpd:ignore-start
122-
# FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659
123-
- id: oidc
124-
uses: ChristopherHX/oidc@73eee1ff03fdfce10eda179f617131532209edbd # v3
125-
126-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
121+
- id: local-workflow-actions
122+
uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@a55670b58d3e064526201acde6c720ede638420c # 0.31.0
127123
with:
128-
persist-credentials: false
129-
path: ./self-workflow
130-
repository: ${{ steps.oidc.outputs.job_workflow_repo_name_and_owner }}
131-
ref: ${{ steps.oidc.outputs.job_workflow_repo_ref }}
132-
sparse-checkout: |
133-
actions
134-
- run: |
135-
echo "self-workflow" >> .gitignore
136-
echo "self-workflow" >> .dockerignore
124+
actions-path: actions
137125

138126
- id: prepare-cleaning
139127
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
128+
env:
129+
REPOSITORY: ${{ fromJSON(inputs.clean-deploy-parameters).repository }}
140130
with:
141131
script: |
142132
// Repository
143-
const repository = `${{ fromJSON(inputs.clean-deploy-parameters).repository }}`.trim();
133+
const repository = process.env.REPOSITORY.trim();
144134
145135
if (repository) {
146136
core.setOutput("repository", repository);
@@ -156,7 +146,6 @@ jobs:
156146
app-id: ${{ inputs.github-app-id }}
157147
private-key: ${{ secrets.github-app-key }}
158148
owner: ${{ steps.prepare-cleaning.outputs.owner }}
159-
# jscpd:ignore-end
160149

161150
- id: delete-deployment
162151
uses: ./self-workflow/actions/deployment/delete
@@ -176,13 +165,11 @@ jobs:
176165
title: "Deployment(s) have been deleted :wastebasket:."
177166
body: "The following deployment(s) have been deleted:\n\n- ${{ join(fromJSON(steps.delete-deployment.outputs.environments),'\n- ') }}"
178167

179-
# FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659
180-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
181-
if: always() && steps.oidc.outputs.job_workflow_repo_name_and_owner
168+
# jscpd:ignore-start
169+
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@a55670b58d3e064526201acde6c720ede638420c # 0.31.0
170+
if: always() && steps.local-workflow-actions.outputs.repository
182171
with:
183-
persist-credentials: false
184-
path: ./self-workflow
185-
repository: ${{ steps.oidc.outputs.job_workflow_repo_name_and_owner }}
186-
ref: ${{ steps.oidc.outputs.job_workflow_repo_ref }}
187-
sparse-checkout: |
188-
actions
172+
actions-path: actions
173+
repository: ${{ steps.local-workflow-actions.outputs.repository }}
174+
ref: ${{ steps.local-workflow-actions.outputs.ref }}
175+
# jscpd:ignore-end

.github/workflows/deploy-argocd-app-of-apps.yml

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ jobs:
8686
permissions:
8787
contents: read
8888
pull-requests: write
89-
# FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659
90-
id-token: write
89+
id-token: write # Needed for getting local workflow actions
9190
outputs:
9291
deployment-id: ${{ steps.check-client-payload.outputs.deployment-id }}
9392
repository: ${{ steps.check-client-payload.outputs.repository }}
@@ -149,34 +148,17 @@ jobs:
149148
with:
150149
persist-credentials: false
151150

152-
# FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659
153-
# jscpd:ignore-start
154-
- id: oidc
155-
uses: ChristopherHX/oidc@73eee1ff03fdfce10eda179f617131532209edbd # v3
156-
157-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
158-
with:
159-
persist-credentials: false
160-
path: ./self-workflow
161-
repository: ${{ steps.oidc.outputs.job_workflow_repo_name_and_owner }}
162-
ref: ${{ steps.oidc.outputs.job_workflow_repo_ref }}
163-
sparse-checkout: |
164-
actions
165-
- run: |
166-
if [ -f .gitignore ]; then grep -q "self-workflow" .gitignore || echo "self-workflow" >> .gitignore; else echo "self-workflow" >> .gitignore; fi
167-
if [ -f .dockerignore ]; then grep -q "self-workflow" .dockerignore || echo "self-workflow" >> .dockerignore; else echo "self-workflow" >> .dockerignore; fi
168-
# jscpd:ignore-end
169-
- id: get-namespace
170-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
171-
with:
172-
script: |
173-
const namespace = `${{ steps.check-client-payload.outputs.repository }}-${{ steps.check-client-payload.outputs.environment }}`;
174-
core.setOutput("namespace", namespace);
175-
176151
- id: slugify-namespace
177152
uses: hoverkraft-tech/ci-github-common/actions/slugify@a55670b58d3e064526201acde6c720ede638420c # 0.31.0
178153
with:
179-
value: ${{ steps.get-namespace.outputs.namespace }}
154+
value: ${{ format('{0}-{1}', steps.check-client-payload.outputs.repository, steps.check-client-payload.outputs.environment) }}
155+
156+
# jscpd:ignore-start
157+
- id: local-workflow-actions
158+
uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@a55670b58d3e064526201acde6c720ede638420c # 0.31.0
159+
with:
160+
actions-path: actions
161+
# jscpd:ignore-end
180162

181163
- id: get-manifest-files
182164
uses: ./self-workflow/actions/argocd/get-manifest-files
@@ -186,22 +168,26 @@ jobs:
186168

187169
- id: get-manifest-templates
188170
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
171+
env:
172+
TEMPLATE_FILENAME: ${{ inputs.template-filename }}
173+
APPLICATION_FILE: ${{ steps.get-manifest-files.outputs.application-file }}
174+
MANIFEST_FILE: ${{ steps.get-manifest-files.outputs.manifest-file }}
189175
with:
190176
script: |
191177
const fs = require("node:fs");
192178
const path = require("node:path");
193179
194-
const templateFilename = ${{ toJSON(inputs.template-filename) }};
180+
const templateFilename = process.env.TEMPLATE_FILENAME.trim();
195181
if (!templateFilename) {
196182
return core.setFailed(`Template filename is not defined`);
197183
}
198184
199-
const applicationFile = ${{ toJSON(steps.get-manifest-files.outputs.application-file) }};
185+
const applicationFile = process.env.APPLICATION_FILE.trim();
200186
if (!applicationFile) {
201187
return core.setFailed(`Application file is not defined`);
202188
}
203189
204-
const manifestFile = ${{ toJSON(steps.get-manifest-files.outputs.manifest-file) }};
190+
const manifestFile = process.env.MANIFEST_FILE.trim();
205191
if (!manifestFile) {
206192
return core.setFailed(`Manifest file is not defined`);
207193
}
@@ -253,3 +239,12 @@ jobs:
253239
feat(${{ steps.check-client-payload.outputs.repository }}): deploy ${{ steps.chart-variables.outputs.version }} to ${{ steps.check-client-payload.outputs.environment }}"
254240
255241
[skip ci]
242+
243+
# jscpd:ignore-start
244+
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@a55670b58d3e064526201acde6c720ede638420c # 0.31.0
245+
if: always() && steps.local-workflow-actions.outputs.repository
246+
with:
247+
actions-path: actions
248+
repository: ${{ steps.local-workflow-actions.outputs.repository }}
249+
ref: ${{ steps.local-workflow-actions.outputs.ref }}
250+
# jscpd:ignore-end

0 commit comments

Comments
 (0)