You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "NightOwl888 (via GitHub)" <gi...@apache.org> on 2026/06/23 21:26:39 UTC
[PR] Updated Docs and Website Automation Trigger + Procedures [lucenenet]
NightOwl888 opened a new pull request, #1386:
URL: https://github.com/apache/lucenenet/pull/1386
<!-- Thank you for submitting a pull request to our repo. -->
<!-- Please do NOT submit PRs for features in newer versions of Lucene. We should keep the target version consistent across our repository to make the upgrade process to newer versions of Lucene go smoothly. -->
<!-- If this is your first PR in the Lucene.NET repo, please run through the checklist
below to ensure a smooth review and merge process for your PR. -->
- [x] You've read the [Contributor Guide](https://github.com/apache/lucenenet/blob/master/CONTRIBUTING.md) and [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
- [ ] You've included unit or integration tests for your change, where applicable.
- [ ] You've included inline docs for your change, where applicable.
- [ ] There's an open issue for the PR that you are making. If you'd like to propose a change, please [open an issue](https://github.com/apache/lucenenet/issues/new/choose) to discuss the change or find an existing issue.
<!-- Once all that is done, you're ready to go. Open the PR with the content below. -->
Updated Docs and Website Automation Trigger + Procedures
## Description
This updates the automation for both the docs and website. Ever since the automation has been put in place, it has had to be executed manually. This update fixes the triggers so the automation happens automatically.
### Website
The trigger was updated to make the `master` branch the source of truth for the website. This makes it simpler to manage because any PRs that are submitted to the `master` branch will be built into a PR on the `lucenenet-site` repo. Once merged, the changes go live.
### Docs
The source of truth for any docs release is its corresponding `docs/<version>` branch. To update the docs, the updates must either be committed to the docs branch directly and merged to `master` or committed to `master` and cherry-picked onto the docs branch(es). The latter approach is generally more flexible.
This updates the trigger to fire automatically when any push is made to the `docs/<version>` site that will automatically build the docs site and submit a PR to the `lucenenet-repo`. Once merged, the changes go live.
Docs branches still must be created manually from a release branch, but once pushed, the automation kicks in.
> NOTE: At some point we will probably want to build the docs from the release branch, but we will need to be consistent with our release branch naming and also there will need to be some sort of hold put on the docs build until the release branch is tagged.
This also corrects the logic so the branch names are uniquely identified by the incoming commit hash so multiple releases can be done on the same docs version.
### Procedures
This updates the `documentation.md` file with a new section for both the docs and website which explain the source of truth for each site, workflows for updating the branches, and outlines some guidelines for how to move changes between branches to update both sites while also working with releases.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Updated Docs and Website Automation Trigger + Procedures [lucenenet]
Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 commented on code in PR #1386:
URL: https://github.com/apache/lucenenet/pull/1386#discussion_r3463862057
##########
.github/workflows/Lucene-Net-Documentation.yml:
##########
@@ -62,71 +68,113 @@ jobs:
path: main-repo
fetch-depth: 0
- - name: Set version from tag
+ - name: Set version from ref
run: |
# initialize to SHA
- echo ("CURRENT_TAG=" + $Env:GITHUB_SHA) >> $env:GITHUB_ENV
+ echo ("CURRENT_REF=" + $Env:GITHUB_SHA) >> $env:GITHUB_ENV
+
$ref = $Env:GITHUB_REF
- if ($ref.StartsWith("refs/tags/")) {
- $tag = $ref.Substring(10)
- echo "extracted tag name from refs/tags as $tag"
- }
- else {
- echo "Get the latest Lucene.Net_ tag"
- $tag = & git --git-dir "$Env:GIT_MAIN_REPO" tag --list --sort=-version:refname 'Lucene.Net_[0-9]_[0-9]_[0-9]*' | select -first 1
- }
+ if ($ref.StartsWith("refs/heads/docs/")) {
- if ($tag -eq $null) {
- echo "::error::Could not determine current version tag"
- exit 1
- }
+ $version = $ref.Substring("refs/heads/docs/".Length)
- # write the environment var
- echo ("CURRENT_TAG=" + $tag) >> $env:GITHUB_ENV
-
- $parts = $tag.Split("_")
- $version = '';
- For ($i=1; $i -le $parts.Length; $i++) {
- $version += $parts[$i]
- if ($i -eq ($parts.Length - 2)) {
- $version += "-"
- }
- elseif ($i -lt ($parts.Length - 1)) {
- $version += "."
- }
- }
+ echo "Detected docs branch version: $version"
- if ($version -ne '') {
- # the tag parsed to the correct version format, write the environment var
- echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
- }
- else {
- echo "::error::Could not parse current version tag"
- exit 1
+ echo ("CURRENT_REF=" + $Env:GITHUB_REF_NAME) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } elseif ($ref.StartsWith("refs/heads/release/")) {
+
+ $version = $ref.Substring("refs/heads/release/".Length)
+
+ echo "Detected release branch version: $version"
+
+ echo ("CURRENT_REF=" + $Env:GITHUB_REF_NAME) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } elseif ($ref.StartsWith("refs/tags/Docs_")) {
+
+ $tag = $ref.Substring(10)
+
+ echo "Detected docs tag: $tag"
+
+ $parts = $tag.Split("_")
+
+ $version = ''
+ for ($i = 1; $i -lt $parts.Length; $i++) {
+ $version += $parts[$i]
+
+ if ($i -eq ($parts.Length - 2)) {
+ $version += "-"
+ }
+ elseif ($i -lt ($parts.Length - 1)) {
+ $version += "."
+ }
+ }
+
+ echo ("CURRENT_REF=" + $tag) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } else {
+
+ echo "No versioned branch detected. Falling back to latest Lucene.Net tag."
+
+ $tag = & git --git-dir "$Env:GIT_MAIN_REPO" tag --list --sort=-version:refname 'Lucene.Net_[0-9]_[0-9]_[0-9]*' | select -first 1
+
+ if ($tag -eq $null) {
+ echo "::error::Could not determine current version"
+ exit 1
+ }
+
+ $parts = $tag.Split("_")
+
+ $version = ''
+ for ($i = 1; $i -lt $parts.Length; $i++) {
+ $version += $parts[$i]
+
+ if ($i -eq ($parts.Length - 2)) {
+ $version += "-"
+ }
+ elseif ($i -lt ($parts.Length - 1)) {
+ $version += "."
+ }
+ }
+
+ echo ("CURRENT_REF=" + $tag) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
}
+
+ - name: Set PR branch name
+ run: |
+ $shortSHA = $Env:GITHUB_SHA.Substring(0, 7)
+
+ echo ("PR_BRANCH=docs-build-" + $Env:RELEASE_VERSION + "-" + $shortSHA) >> $env:GITHUB_ENV
shell: powershell
- name: Verify environment variables
run: |
echo "CURRENT_TAG=$Env:CURRENT_TAG"
+ echo "GITHUB_REF=$Env:GITHUB_REF"
+ echo "GITHUB_REF_NAME=$Env:GITHUB_REF_NAME"
+ echo "GITHUB_SHA=$Env:GITHUB_SHA"
+ echo "CURRENT_REF=$Env:CURRENT_REF"
echo "RELEASE_VERSION=$Env:RELEASE_VERSION"
+ echo "PR_BRANCH=$Env:PR_BRANCH"
shell: powershell
- - name: Change branch
- run: |
- git --git-dir "$Env:GIT_MAIN_REPO" checkout -b "docs/${{ env.RELEASE_VERSION }}"
- shell: powershell
-
- - name: Setup .NET 6 SDK
+ # NOTE: It isn't clear why we were doing this, but removing because this could cause errors when using either docs/VERSION or release/VERSION style branches
+ #- name: Change branch
+ # run: |
+ # git --git-dir "$Env:GIT_MAIN_REPO" checkout -b "docs/${{ env.RELEASE_VERSION }}"
+ # shell: powershell
+
Review Comment:
Thanks. I ended up adding a commit to fix this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Updated Docs and Website Automation Trigger + Procedures [lucenenet]
Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 commented on PR #1386:
URL: https://github.com/apache/lucenenet/pull/1386#issuecomment-4785543464
There is still a problem with how it creates the PR that I am tracking down. The first build didn't drop the docs files into the `api/` folder and instead put all of its subfolders at the root. I confirmed it doesn't happen on the second run, so it appears to be happening because the directory doesn't exist which messes up Powershell's copy.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Updated Docs and Website Automation Trigger + Procedures [lucenenet]
Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 merged PR #1386:
URL: https://github.com/apache/lucenenet/pull/1386
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Updated Docs and Website Automation Trigger + Procedures [lucenenet]
Posted by "jbampton (via GitHub)" <gi...@apache.org>.
jbampton commented on code in PR #1386:
URL: https://github.com/apache/lucenenet/pull/1386#discussion_r3463340597
##########
.github/workflows/Lucene-Net-Documentation.yml:
##########
@@ -62,71 +68,113 @@ jobs:
path: main-repo
fetch-depth: 0
- - name: Set version from tag
+ - name: Set version from ref
run: |
# initialize to SHA
- echo ("CURRENT_TAG=" + $Env:GITHUB_SHA) >> $env:GITHUB_ENV
+ echo ("CURRENT_REF=" + $Env:GITHUB_SHA) >> $env:GITHUB_ENV
+
$ref = $Env:GITHUB_REF
- if ($ref.StartsWith("refs/tags/")) {
- $tag = $ref.Substring(10)
- echo "extracted tag name from refs/tags as $tag"
- }
- else {
- echo "Get the latest Lucene.Net_ tag"
- $tag = & git --git-dir "$Env:GIT_MAIN_REPO" tag --list --sort=-version:refname 'Lucene.Net_[0-9]_[0-9]_[0-9]*' | select -first 1
- }
+ if ($ref.StartsWith("refs/heads/docs/")) {
- if ($tag -eq $null) {
- echo "::error::Could not determine current version tag"
- exit 1
- }
+ $version = $ref.Substring("refs/heads/docs/".Length)
- # write the environment var
- echo ("CURRENT_TAG=" + $tag) >> $env:GITHUB_ENV
-
- $parts = $tag.Split("_")
- $version = '';
- For ($i=1; $i -le $parts.Length; $i++) {
- $version += $parts[$i]
- if ($i -eq ($parts.Length - 2)) {
- $version += "-"
- }
- elseif ($i -lt ($parts.Length - 1)) {
- $version += "."
- }
- }
+ echo "Detected docs branch version: $version"
- if ($version -ne '') {
- # the tag parsed to the correct version format, write the environment var
- echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
- }
- else {
- echo "::error::Could not parse current version tag"
- exit 1
+ echo ("CURRENT_REF=" + $Env:GITHUB_REF_NAME) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } elseif ($ref.StartsWith("refs/heads/release/")) {
+
+ $version = $ref.Substring("refs/heads/release/".Length)
+
+ echo "Detected release branch version: $version"
+
+ echo ("CURRENT_REF=" + $Env:GITHUB_REF_NAME) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } elseif ($ref.StartsWith("refs/tags/Docs_")) {
+
+ $tag = $ref.Substring(10)
+
+ echo "Detected docs tag: $tag"
+
+ $parts = $tag.Split("_")
+
+ $version = ''
+ for ($i = 1; $i -lt $parts.Length; $i++) {
+ $version += $parts[$i]
+
+ if ($i -eq ($parts.Length - 2)) {
+ $version += "-"
+ }
+ elseif ($i -lt ($parts.Length - 1)) {
+ $version += "."
+ }
+ }
+
+ echo ("CURRENT_REF=" + $tag) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } else {
+
+ echo "No versioned branch detected. Falling back to latest Lucene.Net tag."
+
+ $tag = & git --git-dir "$Env:GIT_MAIN_REPO" tag --list --sort=-version:refname 'Lucene.Net_[0-9]_[0-9]_[0-9]*' | select -first 1
+
+ if ($tag -eq $null) {
+ echo "::error::Could not determine current version"
+ exit 1
+ }
+
+ $parts = $tag.Split("_")
+
+ $version = ''
+ for ($i = 1; $i -lt $parts.Length; $i++) {
+ $version += $parts[$i]
+
+ if ($i -eq ($parts.Length - 2)) {
+ $version += "-"
+ }
+ elseif ($i -lt ($parts.Length - 1)) {
+ $version += "."
+ }
+ }
+
+ echo ("CURRENT_REF=" + $tag) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
}
+
+ - name: Set PR branch name
+ run: |
+ $shortSHA = $Env:GITHUB_SHA.Substring(0, 7)
+
Review Comment:
Same again
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Updated Docs and Website Automation Trigger + Procedures [lucenenet]
Posted by "jbampton (via GitHub)" <gi...@apache.org>.
jbampton commented on code in PR #1386:
URL: https://github.com/apache/lucenenet/pull/1386#discussion_r3463076396
##########
.github/workflows/Lucene-Net-Documentation.yml:
##########
@@ -33,13 +33,19 @@ name: 'Lucene.Net.Documentation'
on:
workflow_dispatch:
push:
+ # 2026-06-23 - when both tags and branches are used, they are ORed. However, note that when paths is used, it is ANDed to each of them.
tags:
- Docs_*
- #branches:
- #- master
- paths:
- - 'websites/apidocs/**/*'
- - 'src/docs/LuceneDocsPlugins/**/*'
+ # 2026-06-23 - the docs/** branch is the source of truth for each docs site build. Those branches must be carefully managed to ensure that nothing is committed
+ # to them that deviates from the state of the API at the time of the release. Updates to the spelling or explanation of an API are usually okay. Updates to the
+ # API parameter lists or other criteria that define the public signature are not.
+ branches:
+ - docs/**
+ # 2026-06-23 - the docs/** branches should be "filtered" manaually to ensure no unwanted changes are ever committed. But if so, the PR that this automation
+ # creates can be rejected and the errantly commited changes can be reverted before rebuilding the API docs site.
Review Comment:
```suggestion
# creates can be rejected and the errantly committed changes can be reverted before rebuilding the API docs site.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Updated Docs and Website Automation Trigger + Procedures [lucenenet]
Posted by "jbampton (via GitHub)" <gi...@apache.org>.
jbampton commented on PR #1386:
URL: https://github.com/apache/lucenenet/pull/1386#issuecomment-4783908878
From the https://pre-commit.com site
"Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements. By pointing these issues out before code review, this allows a code reviewer to focus on the architecture of a change while not wasting time with trivial style nitpicks."
The pre-commit tests failed for trailing whitespace and typos.
@NightOwl888 would you like me to add some documentation on how to install and run prek ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Updated Docs and Website Automation Trigger + Procedures [lucenenet]
Posted by "jbampton (via GitHub)" <gi...@apache.org>.
jbampton commented on code in PR #1386:
URL: https://github.com/apache/lucenenet/pull/1386#discussion_r3463328555
##########
.github/workflows/Lucene-Net-Documentation.yml:
##########
@@ -62,71 +68,113 @@ jobs:
path: main-repo
fetch-depth: 0
- - name: Set version from tag
+ - name: Set version from ref
run: |
# initialize to SHA
- echo ("CURRENT_TAG=" + $Env:GITHUB_SHA) >> $env:GITHUB_ENV
+ echo ("CURRENT_REF=" + $Env:GITHUB_SHA) >> $env:GITHUB_ENV
+
$ref = $Env:GITHUB_REF
- if ($ref.StartsWith("refs/tags/")) {
- $tag = $ref.Substring(10)
- echo "extracted tag name from refs/tags as $tag"
- }
- else {
- echo "Get the latest Lucene.Net_ tag"
- $tag = & git --git-dir "$Env:GIT_MAIN_REPO" tag --list --sort=-version:refname 'Lucene.Net_[0-9]_[0-9]_[0-9]*' | select -first 1
- }
+ if ($ref.StartsWith("refs/heads/docs/")) {
- if ($tag -eq $null) {
- echo "::error::Could not determine current version tag"
- exit 1
- }
+ $version = $ref.Substring("refs/heads/docs/".Length)
- # write the environment var
- echo ("CURRENT_TAG=" + $tag) >> $env:GITHUB_ENV
-
- $parts = $tag.Split("_")
- $version = '';
- For ($i=1; $i -le $parts.Length; $i++) {
- $version += $parts[$i]
- if ($i -eq ($parts.Length - 2)) {
- $version += "-"
- }
- elseif ($i -lt ($parts.Length - 1)) {
- $version += "."
- }
- }
+ echo "Detected docs branch version: $version"
- if ($version -ne '') {
- # the tag parsed to the correct version format, write the environment var
- echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
- }
- else {
- echo "::error::Could not parse current version tag"
- exit 1
+ echo ("CURRENT_REF=" + $Env:GITHUB_REF_NAME) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } elseif ($ref.StartsWith("refs/heads/release/")) {
+
+ $version = $ref.Substring("refs/heads/release/".Length)
+
+ echo "Detected release branch version: $version"
+
+ echo ("CURRENT_REF=" + $Env:GITHUB_REF_NAME) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } elseif ($ref.StartsWith("refs/tags/Docs_")) {
+
+ $tag = $ref.Substring(10)
+
+ echo "Detected docs tag: $tag"
+
+ $parts = $tag.Split("_")
+
+ $version = ''
+ for ($i = 1; $i -lt $parts.Length; $i++) {
+ $version += $parts[$i]
+
+ if ($i -eq ($parts.Length - 2)) {
+ $version += "-"
+ }
+ elseif ($i -lt ($parts.Length - 1)) {
+ $version += "."
+ }
+ }
+
+ echo ("CURRENT_REF=" + $tag) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } else {
+
+ echo "No versioned branch detected. Falling back to latest Lucene.Net tag."
+
+ $tag = & git --git-dir "$Env:GIT_MAIN_REPO" tag --list --sort=-version:refname 'Lucene.Net_[0-9]_[0-9]_[0-9]*' | select -first 1
+
+ if ($tag -eq $null) {
+ echo "::error::Could not determine current version"
+ exit 1
+ }
+
+ $parts = $tag.Split("_")
+
+ $version = ''
+ for ($i = 1; $i -lt $parts.Length; $i++) {
+ $version += $parts[$i]
+
+ if ($i -eq ($parts.Length - 2)) {
+ $version += "-"
+ }
+ elseif ($i -lt ($parts.Length - 1)) {
+ $version += "."
+ }
+ }
+
+ echo ("CURRENT_REF=" + $tag) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
}
+
+ - name: Set PR branch name
+ run: |
+ $shortSHA = $Env:GITHUB_SHA.Substring(0, 7)
+
+ echo ("PR_BRANCH=docs-build-" + $Env:RELEASE_VERSION + "-" + $shortSHA) >> $env:GITHUB_ENV
shell: powershell
- name: Verify environment variables
run: |
echo "CURRENT_TAG=$Env:CURRENT_TAG"
+ echo "GITHUB_REF=$Env:GITHUB_REF"
+ echo "GITHUB_REF_NAME=$Env:GITHUB_REF_NAME"
+ echo "GITHUB_SHA=$Env:GITHUB_SHA"
+ echo "CURRENT_REF=$Env:CURRENT_REF"
echo "RELEASE_VERSION=$Env:RELEASE_VERSION"
+ echo "PR_BRANCH=$Env:PR_BRANCH"
shell: powershell
- - name: Change branch
- run: |
- git --git-dir "$Env:GIT_MAIN_REPO" checkout -b "docs/${{ env.RELEASE_VERSION }}"
- shell: powershell
-
- - name: Setup .NET 6 SDK
+ # NOTE: It isn't clear why we were doing this, but removing because this could cause errors when using either docs/VERSION or release/VERSION style branches
+ #- name: Change branch
+ # run: |
+ # git --git-dir "$Env:GIT_MAIN_REPO" checkout -b "docs/${{ env.RELEASE_VERSION }}"
+ # shell: powershell
+
Review Comment:
```suggestion
```
##########
.github/workflows/Lucene-Net-Documentation.yml:
##########
@@ -62,71 +68,113 @@ jobs:
path: main-repo
fetch-depth: 0
- - name: Set version from tag
+ - name: Set version from ref
run: |
# initialize to SHA
- echo ("CURRENT_TAG=" + $Env:GITHUB_SHA) >> $env:GITHUB_ENV
+ echo ("CURRENT_REF=" + $Env:GITHUB_SHA) >> $env:GITHUB_ENV
+
$ref = $Env:GITHUB_REF
- if ($ref.StartsWith("refs/tags/")) {
- $tag = $ref.Substring(10)
- echo "extracted tag name from refs/tags as $tag"
- }
- else {
- echo "Get the latest Lucene.Net_ tag"
- $tag = & git --git-dir "$Env:GIT_MAIN_REPO" tag --list --sort=-version:refname 'Lucene.Net_[0-9]_[0-9]_[0-9]*' | select -first 1
- }
+ if ($ref.StartsWith("refs/heads/docs/")) {
- if ($tag -eq $null) {
- echo "::error::Could not determine current version tag"
- exit 1
- }
+ $version = $ref.Substring("refs/heads/docs/".Length)
- # write the environment var
- echo ("CURRENT_TAG=" + $tag) >> $env:GITHUB_ENV
-
- $parts = $tag.Split("_")
- $version = '';
- For ($i=1; $i -le $parts.Length; $i++) {
- $version += $parts[$i]
- if ($i -eq ($parts.Length - 2)) {
- $version += "-"
- }
- elseif ($i -lt ($parts.Length - 1)) {
- $version += "."
- }
- }
+ echo "Detected docs branch version: $version"
- if ($version -ne '') {
- # the tag parsed to the correct version format, write the environment var
- echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
- }
- else {
- echo "::error::Could not parse current version tag"
- exit 1
+ echo ("CURRENT_REF=" + $Env:GITHUB_REF_NAME) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } elseif ($ref.StartsWith("refs/heads/release/")) {
+
+ $version = $ref.Substring("refs/heads/release/".Length)
+
+ echo "Detected release branch version: $version"
+
+ echo ("CURRENT_REF=" + $Env:GITHUB_REF_NAME) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } elseif ($ref.StartsWith("refs/tags/Docs_")) {
+
+ $tag = $ref.Substring(10)
+
+ echo "Detected docs tag: $tag"
+
+ $parts = $tag.Split("_")
+
+ $version = ''
+ for ($i = 1; $i -lt $parts.Length; $i++) {
+ $version += $parts[$i]
+
+ if ($i -eq ($parts.Length - 2)) {
+ $version += "-"
+ }
+ elseif ($i -lt ($parts.Length - 1)) {
+ $version += "."
+ }
+ }
+
+ echo ("CURRENT_REF=" + $tag) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } else {
+
+ echo "No versioned branch detected. Falling back to latest Lucene.Net tag."
+
+ $tag = & git --git-dir "$Env:GIT_MAIN_REPO" tag --list --sort=-version:refname 'Lucene.Net_[0-9]_[0-9]_[0-9]*' | select -first 1
+
+ if ($tag -eq $null) {
+ echo "::error::Could not determine current version"
+ exit 1
+ }
+
+ $parts = $tag.Split("_")
+
+ $version = ''
+ for ($i = 1; $i -lt $parts.Length; $i++) {
+ $version += $parts[$i]
+
+ if ($i -eq ($parts.Length - 2)) {
+ $version += "-"
+ }
+ elseif ($i -lt ($parts.Length - 1)) {
+ $version += "."
+ }
+ }
+
+ echo ("CURRENT_REF=" + $tag) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
}
+
+ - name: Set PR branch name
+ run: |
+ $shortSHA = $Env:GITHUB_SHA.Substring(0, 7)
+
Review Comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Updated Docs and Website Automation Trigger + Procedures [lucenenet]
Posted by "jbampton (via GitHub)" <gi...@apache.org>.
jbampton commented on code in PR #1386:
URL: https://github.com/apache/lucenenet/pull/1386#discussion_r3463336277
##########
.github/workflows/Lucene-Net-Documentation.yml:
##########
@@ -62,71 +68,113 @@ jobs:
path: main-repo
fetch-depth: 0
- - name: Set version from tag
+ - name: Set version from ref
run: |
# initialize to SHA
- echo ("CURRENT_TAG=" + $Env:GITHUB_SHA) >> $env:GITHUB_ENV
+ echo ("CURRENT_REF=" + $Env:GITHUB_SHA) >> $env:GITHUB_ENV
+
$ref = $Env:GITHUB_REF
- if ($ref.StartsWith("refs/tags/")) {
- $tag = $ref.Substring(10)
- echo "extracted tag name from refs/tags as $tag"
- }
- else {
- echo "Get the latest Lucene.Net_ tag"
- $tag = & git --git-dir "$Env:GIT_MAIN_REPO" tag --list --sort=-version:refname 'Lucene.Net_[0-9]_[0-9]_[0-9]*' | select -first 1
- }
+ if ($ref.StartsWith("refs/heads/docs/")) {
- if ($tag -eq $null) {
- echo "::error::Could not determine current version tag"
- exit 1
- }
+ $version = $ref.Substring("refs/heads/docs/".Length)
- # write the environment var
- echo ("CURRENT_TAG=" + $tag) >> $env:GITHUB_ENV
-
- $parts = $tag.Split("_")
- $version = '';
- For ($i=1; $i -le $parts.Length; $i++) {
- $version += $parts[$i]
- if ($i -eq ($parts.Length - 2)) {
- $version += "-"
- }
- elseif ($i -lt ($parts.Length - 1)) {
- $version += "."
- }
- }
+ echo "Detected docs branch version: $version"
- if ($version -ne '') {
- # the tag parsed to the correct version format, write the environment var
- echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
- }
- else {
- echo "::error::Could not parse current version tag"
- exit 1
+ echo ("CURRENT_REF=" + $Env:GITHUB_REF_NAME) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } elseif ($ref.StartsWith("refs/heads/release/")) {
+
+ $version = $ref.Substring("refs/heads/release/".Length)
+
+ echo "Detected release branch version: $version"
+
+ echo ("CURRENT_REF=" + $Env:GITHUB_REF_NAME) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } elseif ($ref.StartsWith("refs/tags/Docs_")) {
+
+ $tag = $ref.Substring(10)
+
+ echo "Detected docs tag: $tag"
+
+ $parts = $tag.Split("_")
+
+ $version = ''
+ for ($i = 1; $i -lt $parts.Length; $i++) {
+ $version += $parts[$i]
+
+ if ($i -eq ($parts.Length - 2)) {
+ $version += "-"
+ }
+ elseif ($i -lt ($parts.Length - 1)) {
+ $version += "."
+ }
+ }
+
+ echo ("CURRENT_REF=" + $tag) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
+ } else {
+
+ echo "No versioned branch detected. Falling back to latest Lucene.Net tag."
+
+ $tag = & git --git-dir "$Env:GIT_MAIN_REPO" tag --list --sort=-version:refname 'Lucene.Net_[0-9]_[0-9]_[0-9]*' | select -first 1
+
+ if ($tag -eq $null) {
+ echo "::error::Could not determine current version"
+ exit 1
+ }
+
+ $parts = $tag.Split("_")
+
+ $version = ''
+ for ($i = 1; $i -lt $parts.Length; $i++) {
+ $version += $parts[$i]
+
+ if ($i -eq ($parts.Length - 2)) {
+ $version += "-"
+ }
+ elseif ($i -lt ($parts.Length - 1)) {
+ $version += "."
+ }
+ }
+
+ echo ("CURRENT_REF=" + $tag) >> $env:GITHUB_ENV
+ echo ("RELEASE_VERSION=" + $version) >> $env:GITHUB_ENV
}
+
+ - name: Set PR branch name
+ run: |
+ $shortSHA = $Env:GITHUB_SHA.Substring(0, 7)
+
+ echo ("PR_BRANCH=docs-build-" + $Env:RELEASE_VERSION + "-" + $shortSHA) >> $env:GITHUB_ENV
shell: powershell
- name: Verify environment variables
run: |
echo "CURRENT_TAG=$Env:CURRENT_TAG"
+ echo "GITHUB_REF=$Env:GITHUB_REF"
+ echo "GITHUB_REF_NAME=$Env:GITHUB_REF_NAME"
+ echo "GITHUB_SHA=$Env:GITHUB_SHA"
+ echo "CURRENT_REF=$Env:CURRENT_REF"
echo "RELEASE_VERSION=$Env:RELEASE_VERSION"
+ echo "PR_BRANCH=$Env:PR_BRANCH"
shell: powershell
- - name: Change branch
- run: |
- git --git-dir "$Env:GIT_MAIN_REPO" checkout -b "docs/${{ env.RELEASE_VERSION }}"
- shell: powershell
-
- - name: Setup .NET 6 SDK
+ # NOTE: It isn't clear why we were doing this, but removing because this could cause errors when using either docs/VERSION or release/VERSION style branches
+ #- name: Change branch
+ # run: |
+ # git --git-dir "$Env:GIT_MAIN_REPO" checkout -b "docs/${{ env.RELEASE_VERSION }}"
+ # shell: powershell
+
Review Comment:
This is removal of trailing whitespace
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org