diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6405152a..70dc98a5 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,8 +1,6 @@ name: Deploy Docs on: workflow_dispatch: - release: - types: [published] repository_dispatch: types: [build-docs] @@ -27,6 +25,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + ref: main # Always checkout main branch for docs builds fetch-depth: 0 # Fetch all history for all branches and tags fetch-tags: true # Explicitly fetch tags @@ -61,7 +60,13 @@ jobs: - name: Set Release Version in Docs run: | - VERSION=$(cat gradle.properties | grep "version" | cut -d'=' -f2 | tr -d ' ') + # Use the release tag version if triggered by release, otherwise use gradle.properties + if [ "${{ github.event_name }}" = "release" ]; then + VERSION="${{ github.event.release.tag_name }}" + VERSION=${VERSION#v} # Remove 'v' prefix if present + else + VERSION=$(cat gradle.properties | grep "version" | cut -d'=' -f2 | tr -d ' ') + fi echo "Setting documentation version to $VERSION" # For current version