diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index cd3e01a8c..2b6b778c4 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -4,9 +4,14 @@ on: workflow_dispatch: inputs: version: - description: "Version number (e.g. 2.0)" + description: "Version number (e.g. 2.0). Becomes `website/versioned_docs/version-{version_number}.x`." required: true type: string + base_branch: + description: "Git branch to copy from as the versioned docs." + required: false + default: "trunk" + type: string permissions: contents: write @@ -21,19 +26,25 @@ jobs: with: ref: trunk + - name: Overlay docs from base branch + run: | + git fetch origin ${{ inputs.base_branch }} + git checkout FETCH_HEAD -- website/docs + - name: Create release branch and run release script working-directory: website run: | - git checkout -b "release/docs-v${{ inputs.version }}" + git checkout -b "release/docs-v${{ inputs.version }}-${{ github.run_id }}" ./create-release.sh "${{ inputs.version }}" - name: Commit and push run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" + git checkout trunk -- website/docs git add -A git commit -m "Add versioned docs for v${{ inputs.version }}" - git push origin "release/docs-v${{ inputs.version }}" + git push origin "release/docs-v${{ inputs.version }}-${{ github.run_id }}" - name: Create Pull Request env: @@ -41,7 +52,7 @@ jobs: run: | gh pr create \ --base trunk \ - --head "release/docs-v${{ inputs.version }}" \ + --head "release/docs-v${{ inputs.version }}-${{ github.run_id }}" \ --title "Add versioned docs for v${{ inputs.version }}" \ --body "Creates versioned documentation snapshot for v${{ inputs.version }}." \ --label "area/docs"