Skip to content

Commit f776640

Browse files
authored
Merge pull request #618 from dcs4cop/alicja-xxx-harmonisation_and_expansion_of_gha
Harmonisation and expansion of github workflow
2 parents 6e40e2f + e28af34 commit f776640

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed

.github/workflows/xcube_workflow.yaml

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
release:
66
types: [published]
77

8+
env:
9+
APP_NAME: xcube
10+
ORG_NAME: bcdev
11+
IMG_REG_NAME: quay.io
12+
813
jobs:
914
unittest:
1015
runs-on: ubuntu-latest
@@ -38,17 +43,14 @@ jobs:
3843
verbose: true # optional (default = false)
3944
build-docker-image:
4045
runs-on: ubuntu-latest
41-
# Only run if unittests succeed
42-
needs: unittest
4346
# Build the docker image and push to quay.io
4447
name: build-docker-image
45-
env:
46-
APP_NAME: xcube
47-
ORG_NAME: bcdev
48+
# Only run if unittests succeed
49+
needs: unittest
4850
steps:
4951
- name: git-checkout
5052
uses: actions/checkout@v2
51-
# Strip the release tag from refs
53+
# Determine release tag from git ref
5254
- name: get-release-tag
5355
id: release
5456
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
@@ -65,26 +67,23 @@ jobs:
6567
with:
6668
image: ${{ env.ORG_NAME }}/${{ env.APP_NAME }}
6769
tags: master, latest
68-
registry: quay.io
69-
username: ${{ secrets.QUAY_DOCKER_REPO_USERNAME }}
70-
password: ${{ secrets.QUAY_DOCKER_REPO_PASSWORD }}
70+
registry: ${{ env.IMG_REG_NAME }}
71+
username: ${{ secrets.IMG_REG_USERNAME }}
72+
password: ${{ secrets.IMG_REG_PASSWORD }}
7173
# Build and push docker release to quay.io when the event is a 'release'
7274
- uses: mr-smithers-excellent/docker-build-push@v5
7375
name: build-push-docker-image-release
7476
if: ${{ github.event_name == 'release' }}
7577
with:
7678
image: ${{ env.ORG_NAME }}/${{ env.APP_NAME }}
7779
tags: ${{ steps.release.outputs.tag }}
78-
registry: quay.io
79-
username: ${{ secrets.QUAY_DOCKER_REPO_USERNAME }}
80-
password: ${{ secrets.QUAY_DOCKER_REPO_PASSWORD }}
80+
registry: ${{ env.IMG_REG_NAME }}
81+
username: ${{ secrets.IMG_REG_USERNAME }}
82+
password: ${{ secrets.IMG_REG_PASSWORD }}
8183
update-version:
82-
env:
83-
PUSH: 0
84-
APP_NAME: xcube
8584
runs-on: ubuntu-latest
8685
needs: build-docker-image
87-
name: update-tag
86+
name: update-xcube-tag
8887
steps:
8988
- name: git-checkout
9089
uses: actions/checkout@v2
@@ -105,7 +104,7 @@ jobs:
105104
- name: get-hash
106105
id: get-hash
107106
run: |
108-
HASH=$(skopeo inspect docker://quay.io/bcdev/${{ env.APP_NAME }}:${{ steps.release.outputs.tag }} | jq '.Digest')
107+
HASH=$(skopeo inspect docker://${{ env.IMG_REG_NAME }}/${{ env.ORG_NAME }}/${{ env.APP_NAME }}:${{ steps.release.outputs.tag }} | jq '.Digest')
109108
if [[ "$HASH" == *"sha256"* ]]; then
110109
echo ::set-output name=hash::$HASH
111110
else
@@ -128,13 +127,34 @@ jobs:
128127
delimiter: ' '
129128
tag: ${{ steps.deployment-phase.outputs.tag }}
130129
hash: ${{ steps.get-hash.outputs.hash }}
131-
working-directory: "./k8s/xcube-gen/helm"
130+
working-directory: ./k8s/xcube-gen/helm
132131
- name: cat-result
133-
working-directory: "./k8s/xcube-gen/helm"
132+
working-directory: ./k8s/xcube-gen/helm
134133
run: |
135134
head values-dev.yaml
136135
head values-stage.yaml
137136
head values-prod.yaml
137+
# Update the xcube viewer app version tag in k8s-configs/xcube-viewer-app
138+
- name: set-version-tag-xcube-viewer-app
139+
uses: bc-org/gha-update-application-version-tags@main
140+
with:
141+
app: xcube
142+
phase: ${{ steps.deployment-phase.outputs.phase }}
143+
delimiter: ' '
144+
tag: ${{ steps.deployment-phase.outputs.tag }}
145+
hash: ${{ steps.get-hash.outputs.hash }}
146+
working-directory: ./k8s/xcube-viewer-app/xcube-api
147+
prefix: values-*
148+
# Check results
149+
- name: cat-result
150+
working-directory: ./k8s/xcube-viewer-app/xcube-api
151+
run: |
152+
echo "----------------DEV-------------------"
153+
head values-*-dev.yaml
154+
echo "----------------STAGE-----------------"
155+
head values-*-stage.yaml
156+
echo "----------------PROD------------------"
157+
head values-*-prod.yaml
138158
- name: Pushes to another repository
139159
# Don't run if run locally and should be ignored
140160
if: ${{ steps.deployment-phase.outputs.phase != 'ignore' && !env.ACT }}
@@ -147,4 +167,4 @@ jobs:
147167
destination-repository-name: 'k8s-configs'
148168
user-email: [email protected]
149169
target-branch: main
150-
commit-message: ${{ github.event.release }}. Set version to ${{ steps.release.outputs.tag }}
170+
commit-message: ${{ github.event.release }}. Set version to ${{ steps.release.outputs.tag }} and ${{ steps.release.outputs.hash }}

0 commit comments

Comments
 (0)