Skip to content

Commit 8fd3081

Browse files
committed
update deploy action
1 parent c281e89 commit 8fd3081

File tree

3 files changed

+42
-37
lines changed

3 files changed

+42
-37
lines changed

.github/workflows/test-action.yml

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -277,39 +277,44 @@ jobs:
277277
# wget -q https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - |\
278278
# tar xz && mv ${BINARY} /usr/local/bin/yq
279279

280-
deploy-release:
281-
runs-on: ubuntu-latest
282-
needs:
283-
- upload-to-quay
284-
steps:
285-
- uses: actions/checkout@v2
286-
with:
287-
repository: ${{env.GITOPS_REPO}}
288-
token: secrets.GITLAB_ACCESS_TOKEN
289-
290-
- uses: imranismail/setup-kustomize@v1
291-
with:
292-
kustomize-version: 4.0.0
293-
294-
- run: kustomize edit set image ${{env.APP_IMAGE}}:${GITHUB_REF#refs/*/}
295-
working-directory: apps/${{env.APP_NAME}}/overlays/test
296-
297-
- run: |
298-
git config user.email "[email protected]"
299-
git config user.name "gitops"
300-
git commit -am "Gitops update to $APP_NAME"
301-
git pull --rebase
302-
git push
303-
- name: Update YAML file
304-
shell: bash
305-
env:
306-
COMMITPREFIX: '[CTS]'
307-
run: |
308-
309-
curl -s --header "PRIVATE-TOKEN: ${{}}" "${{vars.TARGET_GITLAB_REPOSITORY}}/files/${{vars.GITLAB_FILEPATH}}?ref=${{vars.TARGET_GITLAB_REFERENCE}}" -H "Accept: application/json" -H "Content-Type: application/json" | jq -r '.content' | base64 --decode > response.yaml
310-
yq -i "${{vars.YAML_PATH}} = \"${{needs.update-version.outputs.okr-docker-image}}\"" response.yaml
311-
UPDATED_CONTENT=$(cat response.yaml)
312-
curl --request PUT --header 'PRIVATE-TOKEN: ${{secrets.GITLAB_ACCESS_TOKEN}}' -F "branch=${{vars.TARGET_GITLAB_REFERENCE}}" -F "[email protected]" -F "author_name=GitLab Actions" -F "content=${UPDATED_CONTENT}" -F "commit_message=$COMMITPREFIX Automated changes to ${{vars.FILEPATH_COMMIT}}" "${{vars.TARGET_GITLAB_REPOSITORY}}/files/${{vars.GITLAB_FILEPATH}}"
280+
deploy-release:
281+
runs-on: ubuntu-latest
282+
needs:
283+
- upload-to-quay
284+
steps:
285+
- uses: actions/checkout@v4
286+
with:
287+
repository: ${{ TARGET_GITLAB_REPOSITORY }}
288+
token: ${{ secrets.GITLAB_ACCESS_TOKEN }}
289+
ref: ${{ vars.TARGET_GITLAB_REFERENCE }}
290+
291+
- uses: imranismail/setup-kustomize@v2
292+
with:
293+
kustomize-version: 4.0.0
294+
295+
- name: Update image tag
296+
run: kustomize edit set image ${{env.APP_IMAGE}}:${GITHUB_REF#refs/*/}
297+
env:
298+
COMMITPREFIX: '[CTS]'
299+
working-directory: apps/${{env.APP_NAME}}/overlays/test
300+
301+
- run: |
302+
git config user.email "[email protected]"
303+
git config user.name "gitops"
304+
git commit -am "Gitops update to $APP_NAME"
305+
git pull --rebase
306+
git push
307+
308+
# - name: Update YAML file
309+
# shell: bash
310+
# env:
311+
# COMMITPREFIX: '[CTS]'
312+
# run: |
313+
#
314+
# curl -s --header "PRIVATE-TOKEN: ${{}}" "${{vars.TARGET_GITLAB_REPOSITORY}}/files/${{vars.GITLAB_FILEPATH}}?ref=${{vars.TARGET_GITLAB_REFERENCE}}" -H "Accept: application/json" -H "Content-Type: application/json" | jq -r '.content' | base64 --decode > response.yaml
315+
# yq -i "${{vars.YAML_PATH}} = \"${{needs.update-version.outputs.okr-docker-image}}\"" response.yaml
316+
# UPDATED_CONTENT=$(cat response.yaml)
317+
# curl --request PUT --header 'PRIVATE-TOKEN: ${{secrets.GITLAB_ACCESS_TOKEN}}' -F "branch=${{vars.TARGET_GITLAB_REFERENCE}}" -F "[email protected]" -F "author_name=GitLab Actions" -F "content=${UPDATED_CONTENT}" -F "commit_message=$COMMITPREFIX Automated changes to ${{vars.FILEPATH_COMMIT}}" "${{vars.TARGET_GITLAB_REPOSITORY}}/files/${{vars.GITLAB_FILEPATH}}"
313318

314319
# create-release:
315320
# runs-on: ubuntu-24.04

backend/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<parent>
77
<groupId>ch.puzzle.okr</groupId>
88
<artifactId>parent</artifactId>
9-
<version>7.0.0</version>
9+
<version>3.2.10-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>backend</artifactId>
13-
<version>7.0.0</version>
13+
<version>3.2.10-SNAPSHOT</version>
1414
<name>backend</name>
1515
<description>Puzzle OKR Tool</description>
1616

@@ -213,7 +213,7 @@
213213
<plugin>
214214
<groupId>org.apache.maven.plugins</groupId>
215215
<artifactId>maven-failsafe-plugin</artifactId>
216-
<version>3.5.2</version>
216+
<version>3.5.3</version>
217217
<configuration>
218218
<excludes></excludes>
219219
</configuration>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<groupId>ch.puzzle.okr</groupId>
1010
<artifactId>parent</artifactId>
11-
<version>7.0.0</version>
11+
<version>3.2.10-SNAPSHOT</version>
1212

1313
<parent>
1414
<groupId>org.springframework.boot</groupId>

0 commit comments

Comments
 (0)