Skip to content

Commit 76bc1d7

Browse files
github action to pass version
1 parent 1cf4bf1 commit 76bc1d7

3 files changed

Lines changed: 28 additions & 3 deletions

File tree

.github/workflows/frontend.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
push:
44
branches:
55
- main
6+
# Publish semver tags as releases
7+
tags: [ '*.*.*' ]
68
pull_request:
79
jobs:
810
test:

.github/workflows/saas.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,26 @@ jobs:
6767
with:
6868
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
6969

70+
# Extract version from tag if this is a tag push
71+
- name: Extract version from tag
72+
id: get_version
73+
if: startsWith(github.ref, 'refs/tags/')
74+
run: |
75+
VERSION=${GITHUB_REF#refs/tags/}
76+
VERSION=${VERSION#v}
77+
echo "version=$VERSION" >> $GITHUB_OUTPUT
78+
echo "Release version: $VERSION"
79+
7080
# Build and push Docker image with Buildx (don't push on PR)
7181
# https://github.com/docker/build-push-action
7282
- name: Build and push Docker image
7383
id: build-and-push
7484
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
7585
with:
7686
context: .
77-
build-args: SAAS=1
87+
build-args: |
88+
SAAS=1
89+
${{ startsWith(github.ref, 'refs/tags/') && format('VERSION={0}', steps.get_version.outputs.version) || '' }}
7890
push: ${{ github.event_name != 'pull_request' }}
7991
tags: ${{ steps.meta.outputs.tags }}
8092
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
FROM node:22-slim AS front_builder
2+
ARG VERSION
3+
ARG SAAS
24
SHELL ["/bin/bash", "-c"]
35
WORKDIR /app/frontend
46
COPY frontend/package.json frontend/yarn.lock frontend/angular.json frontend/tsconfig.app.json frontend/tsconfig.json /app/frontend/
@@ -7,8 +9,17 @@ RUN apt-get update && apt-get install -y \
79
git \
810
&& rm -rf /var/lib/apt/lists/*
911
RUN yarn install --immutable --network-timeout 1000000 --silent
12+
COPY frontend/scripts /app/frontend/scripts
1013
COPY frontend/src /app/frontend/src
11-
ARG SAAS
14+
15+
# Update version if VERSION build arg is provided
16+
RUN if [[ -n $VERSION ]]; then \
17+
cd frontend; \
18+
echo "Updating package.json version to $VERSION" && \
19+
npm version $VERSION --no-git-tag-version && \
20+
yarn update-version; \
21+
fi
22+
1223
RUN if [[ -n $SAAS ]]; then API_ROOT=/api yarn build --configuration=saas-production; \
1324
else API_ROOT=/api yarn build --configuration=production; fi
1425
RUN ls /app/frontend/dist/dissendium-v0
@@ -21,7 +32,7 @@ RUN apt-get update && apt-get install -y \
2132
tini nginx \
2233
make gcc g++ python3 \
2334
libxml2 \
24-
&& rm -rf /var/lib/apt/lists/*
35+
&& rm -rf /var/lib/apt/lists/*
2536

2637
WORKDIR /app
2738
COPY package.json .yarnrc.yml yarn.lock /app/

0 commit comments

Comments
 (0)