Skip to content

Commit 5c50f01

Browse files
committed
Fixed for full on deploy
1 parent 71f86c5 commit 5c50f01

2 files changed

Lines changed: 87 additions & 19 deletions

File tree

.github/actions/docker/action.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,7 @@ runs:
9494
echo "Branch name: $BRANCH_NAME"
9595
echo "Release version: $VERSION"
9696
97-
if [[ $INPUT_TAG != '' ]]; then
98-
TAG="${IMAGE_NAME}:${INPUT_TAG}"
99-
elif [[ "$BRANCH_NAME" == "main" ]]; then
100-
if [[ $VERSION == '' ]]; then
101-
printf '%s\n' "Test case x failed" >&2
102-
exit 1
103-
fi
104-
TAG="${IMAGE_NAME}:${VERSION}"
105-
elif [[ "$BRANCH_NAME" == "develop" ]] || [[ "$BRANCH_NAME" == release-* ]] || [[ "$BRANCH_NAME" == hotfix-* ]]; then
106-
TAG="${IMAGE_NAME}:${BRANCH_NAME}-${DATE}"
107-
else
108-
TAG="${IMAGE_NAME}:${BRANCH_NAME}"
109-
fi
110-
97+
TAG="${IMAGE_NAME}:${BRANCH_NAME}-${DATE}"
11198
echo "tag=${TAG}" >> $GITHUB_OUTPUT
11299
113100
- name: Docker build image

.github/workflows/BUILD_AND_DEPLOY.yml

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,92 @@ jobs:
1414
- uses: actions/checkout@v6
1515
name: Checkout
1616

17-
- name: Get project version from build.gradle.kts
18-
id: get_version
17+
- name: Set up Node.js ${{ env.NODE_VERSION }}
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: ${{ env.NODE_VERSION }}
21+
22+
- name: Download libraries dist artifact
23+
uses: actions/download-artifact@v4
24+
with:
25+
name: ${{ inputs.frontend_libraries_build_artifact_name }}
26+
path: frontend/dist/
27+
28+
- name: Move local devDependencies to dependencies and install
29+
shell: bash
30+
run: |
31+
set -euo pipefail
32+
33+
PROJECTS_DIR="projects/valtimo"
34+
SCOPE="@valtimo"
35+
LOCAL_ROOT="dist/valtimo"
36+
PKG_JSON="package.json"
37+
38+
if [ ! -f "$PKG_JSON" ]; then
39+
echo "❌ $PKG_JSON niet gevonden in repo-root"; exit 1
40+
fi
41+
if [ ! -d "$PROJECTS_DIR" ]; then
42+
echo "ℹ️ '$PROJECTS_DIR' niet gevonden; niets te doen."; exit 0
43+
fi
44+
45+
echo "🔎 Subfolders in '$PROJECTS_DIR' verzamelen…"
46+
mapfile -t NAMES < <(find "$PROJECTS_DIR" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | grep -v '^\.' || true)
47+
48+
if [ "${#NAMES[@]}" -eq 0 ]; then
49+
echo "ℹ️ Geen subfolders gevonden; niets te doen."; exit 0
50+
fi
51+
52+
for name in "${NAMES[@]}"; do
53+
npm pkg delete devDependencies."$SCOPE/$name" || true
54+
npm pkg set dependencies.@valtimo/$name="file:$LOCAL_ROOT/$name"
55+
done
56+
57+
echo "📦 npm install…"
58+
npm install
59+
60+
echo "🎉 Klaar. Geüpdatet packages:"
61+
for name in "${NAMES[@]}"; do
62+
echo " - ${SCOPE}/${name} -> file:${LOCAL_ROOT}/${name}"
63+
done
64+
65+
echo "Content of package.json:"
66+
cat package.json
67+
68+
sed -i "s/\"dist\/valtimo/\"dist\/valtimo/g" angular.json
69+
70+
- name: Build app (optioneel voor andere outputs)
71+
run: npm run build
72+
73+
- name: Log in to GitHub Container Registry
74+
uses: docker/login-action@v3
75+
with:
76+
registry: ghcr.io
77+
username: ${{ github.actor }}
78+
password: ${{ secrets.GITHUB_TOKEN }}
79+
80+
- name: Resolve frontend tree hash
81+
id: frontend_tree
82+
run: echo "tree=$(git rev-parse HEAD:frontend)" >> "$GITHUB_OUTPUT"
83+
84+
- name: Generate image tags
85+
id: generate_tags
86+
uses: docker/metadata-action@v5
87+
env:
88+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
89+
with:
90+
images: ghcr.io/${{ github.repository }}/gzac-frontend
91+
tags: |
92+
type=raw,value=${{ env.BRANCH_NAME }}-test.${{ github.run_number }}
93+
type=raw,value=commit-test-${{ github.sha }}
94+
type=raw,value=contents-test-${{ steps.frontend_tree.outputs.tree }}
95+
flavor: |
96+
latest=false
97+
98+
- name: Extract primary image tag
99+
id: primary_tag
19100
run: |
20-
version=$(awk -F= '/^projectVersion/ {gsub(/^[ \t]+|[ \t]+$/, "", $2); print $2; exit}' gradle.properties)
21-
echo "version=$version" >> $GITHUB_OUTPUT
101+
full_tag='${{ fromJson(steps.generate_tags.outputs.json).tags[0] }}'
102+
echo "tag=${full_tag##*:}" >> "$GITHUB_OUTPUT"
22103
23104
- uses: ./.github/actions/docker
24105
name: Build and push to Azure Container Registry
@@ -31,4 +112,4 @@ jobs:
31112
registry: "commongroundacr.azurecr.io"
32113
push: ${{ github.event_name != 'pull_request' }}
33114
vulnerability_scan: false
34-
version: ${{ steps.get_version.outputs.version }}
115+
version: ${{ steps.primary_tag.outputs.full_tag }}

0 commit comments

Comments
 (0)