Skip to content

Commit

Permalink
Fix path to tag script and add support for tag only workflows (#940)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbaldry authored Jan 8, 2025
1 parent f092a0d commit 7ed0517
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions publish-technical-documentation-release/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ inputs:
source_directory:
default: docs/sources
description: Path to source directory, relative to the project root, to sync documentation from.
tags_only:
default: false
description: |
Set to true for repositories that only release from tags and don't maintain long lived release branches.
website_branch:
default: master
description: |
Expand All @@ -61,12 +65,14 @@ runs:
- name: Switch to HEAD of branch for tags
# Tags aren't necessarily made to the HEAD of the branch.
# The documentation to be published is always on the HEAD of the branch.
if: github.ref_type == 'tag'
# However, if the repository only releases from tags, there's no release branch to check out.
if: github.ref_type == 'tag' && !inputs.tag_only
env:
GITHUB_ACTION_PATH: ${{ github.action_path }}
GITHUB_REF: ${{ github.ref }}
RELEASE_BRANCH_REGEXP: ${{ inputs.release_branch_regexp }}
run: |
branch="$(./publish-technical-documentation-release/determine-release-branch "${RELEASE_BRANCH_REGEXP}" "${GITHUB_REF}")"
branch="$(${GITHUB_ACTION_PATH}/determine-release-branch "${RELEASE_BRANCH_REGEXP}" "${GITHUB_REF}")"
if [[ -z "${branch}" ]]; then
echo "No release branch found for tag ${GITHUB_REF} matching ${RELEASE_BRANCH_REGEXP}. Exiting."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ BRANCH_REGEXP="$1"
TAG="${2#refs/tags/}"

contains="$(git branch -a --contains "tags/${TAG}")"
IFS=$'\n'
for branch in ${contains}; do
branch="${branch#remotes/origin/}";
branch="${branch# remotes/origin/}";
echo "Checking branch ${branch} against ${BRANCH_REGEXP}." >&2

if [[ "${branch}" =~ ${BRANCH_REGEXP} ]]; then
Expand Down

0 comments on commit 7ed0517

Please sign in to comment.