Skip to content

Commit 79451fd

Browse files
committed
update documentation only when a release version was built
1 parent b6b5cbc commit 79451fd

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

.github/workflows/CI.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,34 @@ env:
1818
jobs:
1919
build:
2020
runs-on: ubuntu-latest
21+
outputs:
22+
is_release_version: ${{ steps.check-version.outputs.is_release_version }}
23+
version: ${{ steps.check-version.outputs.version }}
2124
permissions:
2225
contents: read
2326
steps:
2427
- name: Checkout code
2528
uses: actions/checkout@v4
2629
with:
2730
fetch-depth: 0
31+
32+
- name: Extract version and check if it's a release version
33+
id: check-version
34+
run: |
35+
# Extract version from build.gradle.kts
36+
VERSION=$(grep -E "val projectVersion = " build.gradle.kts | sed -E 's/.*"(.*)".*/\1/')
37+
echo "Extracted version: $VERSION"
38+
39+
# Check if it's a release version (no suffix like -SNAPSHOT, -rc, etc.)
40+
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
41+
echo "This is a release version"
42+
echo "is_release_version=true" >> $GITHUB_OUTPUT
43+
else
44+
echo "This is not a release version"
45+
echo "is_release_version=false" >> $GITHUB_OUTPUT
46+
fi
47+
48+
echo "version=$VERSION" >> $GITHUB_OUTPUT
2849
2950
# Setup JDK 17 for build
3051
- name: 'Set up JDK 17'
@@ -169,14 +190,33 @@ jobs:
169190
uses: JetBrains/writerside-checker-action@v1
170191
with:
171192
instance: ${{ env.INSTANCE }}
193+
194+
log-docs-deployment-status:
195+
needs: [build, test-docs]
196+
runs-on: ubuntu-latest
197+
if: ${{ needs.build.outputs.is_release_version != 'true' }}
198+
steps:
199+
- name: Log version information
200+
run: |
201+
echo "Project version: ${{ needs.build.outputs.version }}"
202+
echo "Is release version: ${{ needs.build.outputs.is_release_version }}"
203+
echo "Skipping documentation deployment because this is not a final release version."
204+
echo "Documentation will only be deployed for versions in the format a.b.c without any suffix."
172205
173206
deploy-docs:
174207
environment:
175208
name: github-pages
176209
url: ${{ steps.deployment.outputs.page_url }}
177-
needs: [build-docs, test-docs]
210+
needs: [build, build-docs, test-docs]
211+
if: ${{ needs.build.outputs.is_release_version == 'true' }}
178212
runs-on: ubuntu-latest
179213
steps:
214+
- name: Log version information
215+
run: |
216+
echo "Project version: ${{ needs.build.outputs.version }}"
217+
echo "Is release version: ${{ needs.build.outputs.is_release_version }}"
218+
echo "Deploying documentation to GitHub Pages because this is a final release version."
219+
180220
- name: Download artifacts
181221
uses: actions/download-artifact@v4
182222
with:

0 commit comments

Comments
 (0)